mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-22 20:15:51 +00:00
Remove Journal from most Stoppable overrides
This commit is contained in:
@@ -65,47 +65,47 @@ void Stoppable::stopped ()
|
|||||||
m_stoppedEvent.signal();
|
m_stoppedEvent.signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stoppable::onPrepare (Journal journal)
|
void Stoppable::onPrepare ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stoppable::onStart (Journal journal)
|
void Stoppable::onStart ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stoppable::onStop (Journal journal)
|
void Stoppable::onStop ()
|
||||||
{
|
{
|
||||||
stopped();
|
stopped();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stoppable::onChildrenStopped (Journal journal)
|
void Stoppable::onChildrenStopped ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
void Stoppable::prepareRecursive (Journal journal)
|
void Stoppable::prepareRecursive ()
|
||||||
{
|
{
|
||||||
onPrepare (journal);
|
|
||||||
for (Children::const_iterator iter (m_children.cbegin ());
|
for (Children::const_iterator iter (m_children.cbegin ());
|
||||||
iter != m_children.cend(); ++iter)
|
iter != m_children.cend(); ++iter)
|
||||||
iter->stoppable->prepareRecursive (journal);
|
iter->stoppable->prepareRecursive ();
|
||||||
|
onPrepare ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stoppable::startRecursive (Journal journal)
|
void Stoppable::startRecursive ()
|
||||||
{
|
{
|
||||||
onStart (journal);
|
onStart ();
|
||||||
for (Children::const_iterator iter (m_children.cbegin ());
|
for (Children::const_iterator iter (m_children.cbegin ());
|
||||||
iter != m_children.cend(); ++iter)
|
iter != m_children.cend(); ++iter)
|
||||||
iter->stoppable->startRecursive (journal);
|
iter->stoppable->startRecursive ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stoppable::stopAsyncRecursive (Journal journal)
|
void Stoppable::stopAsyncRecursive ()
|
||||||
{
|
{
|
||||||
onStop (journal);
|
onStop ();
|
||||||
for (Children::const_iterator iter (m_children.cbegin ());
|
for (Children::const_iterator iter (m_children.cbegin ());
|
||||||
iter != m_children.cend(); ++iter)
|
iter != m_children.cend(); ++iter)
|
||||||
iter->stoppable->stopAsyncRecursive (journal);
|
iter->stoppable->stopAsyncRecursive ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stoppable::stopRecursive (Journal journal)
|
void Stoppable::stopRecursive (Journal journal)
|
||||||
@@ -120,7 +120,7 @@ void Stoppable::stopRecursive (Journal journal)
|
|||||||
//
|
//
|
||||||
memoryBarrier ();
|
memoryBarrier ();
|
||||||
m_childrenStopped = true;
|
m_childrenStopped = true;
|
||||||
onChildrenStopped (journal);
|
onChildrenStopped ();
|
||||||
|
|
||||||
// Now block on this Stoppable.
|
// Now block on this Stoppable.
|
||||||
//
|
//
|
||||||
@@ -151,30 +151,24 @@ bool RootStoppable::isStopping() const
|
|||||||
return m_calledStopAsync.get() != 0;
|
return m_calledStopAsync.get() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RootStoppable::prepare (Journal journal)
|
void RootStoppable::prepare ()
|
||||||
{
|
{
|
||||||
if (! m_prepared.compareAndSetBool (1, 0))
|
if (! m_prepared.compareAndSetBool (1, 0))
|
||||||
{
|
|
||||||
journal.warning << "Stoppable::prepare called again";
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
prepareRecursive (journal);
|
prepareRecursive ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RootStoppable::start (Journal journal)
|
void RootStoppable::start ()
|
||||||
{
|
{
|
||||||
// Courtesy call to prepare.
|
// Courtesy call to prepare.
|
||||||
if (m_prepared.compareAndSetBool (1, 0))
|
if (m_prepared.compareAndSetBool (1, 0))
|
||||||
prepareRecursive (journal);
|
prepareRecursive ();
|
||||||
|
|
||||||
if (! m_started.compareAndSetBool (1, 0))
|
if (! m_started.compareAndSetBool (1, 0))
|
||||||
{
|
|
||||||
journal.warning << "Stoppable::start called again";
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
startRecursive (journal);
|
startRecursive ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RootStoppable::stop (Journal journal)
|
void RootStoppable::stop (Journal journal)
|
||||||
@@ -185,14 +179,14 @@ void RootStoppable::stop (Journal journal)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
stopAsync (journal);
|
stopAsync ();
|
||||||
stopRecursive (journal);
|
stopRecursive (journal);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RootStoppable::stopAsync (Journal journal)
|
void RootStoppable::stopAsync ()
|
||||||
{
|
{
|
||||||
if (! m_calledStopAsync.compareAndSetBool (1, 0))
|
if (! m_calledStopAsync.compareAndSetBool (1, 0))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
stopAsyncRecursive (journal);
|
stopAsyncRecursive ();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,10 +185,10 @@ public:
|
|||||||
The default implementation does nothing.
|
The default implementation does nothing.
|
||||||
Guaranteed to only be called once.
|
Guaranteed to only be called once.
|
||||||
*/
|
*/
|
||||||
virtual void onPrepare (Journal journal);
|
virtual void onPrepare ();
|
||||||
|
|
||||||
/** Override called during start. */
|
/** Override called during start. */
|
||||||
virtual void onStart (Journal journal);
|
virtual void onStart ();
|
||||||
|
|
||||||
/** Override called when the stop notification is issued.
|
/** Override called when the stop notification is issued.
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ public:
|
|||||||
Guaranteed only to be called once.
|
Guaranteed only to be called once.
|
||||||
Must be safe to call from any thread at any time.
|
Must be safe to call from any thread at any time.
|
||||||
*/
|
*/
|
||||||
virtual void onStop (Journal journal);
|
virtual void onStop ();
|
||||||
|
|
||||||
/** Override called when all children have stopped.
|
/** Override called when all children have stopped.
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ public:
|
|||||||
Guaranteed only to be called once.
|
Guaranteed only to be called once.
|
||||||
Must be safe to call from any thread at any time.
|
Must be safe to call from any thread at any time.
|
||||||
*/
|
*/
|
||||||
virtual void onChildrenStopped (Journal journal);
|
virtual void onChildrenStopped ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class RootStoppable;
|
friend class RootStoppable;
|
||||||
@@ -248,9 +248,9 @@ private:
|
|||||||
Stoppable* stoppable;
|
Stoppable* stoppable;
|
||||||
};
|
};
|
||||||
|
|
||||||
void prepareRecursive (Journal journal);
|
void prepareRecursive ();
|
||||||
void startRecursive (Journal journal);
|
void startRecursive ();
|
||||||
void stopAsyncRecursive (Journal journal);
|
void stopAsyncRecursive ();
|
||||||
void stopRecursive (Journal journal);
|
void stopRecursive (Journal journal);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -280,7 +280,7 @@ public:
|
|||||||
Thread safety:
|
Thread safety:
|
||||||
May be called from any thread.
|
May be called from any thread.
|
||||||
*/
|
*/
|
||||||
void prepare (Journal journal = Journal());
|
void prepare ();
|
||||||
|
|
||||||
/** Start all contained Stoppable objects.
|
/** Start all contained Stoppable objects.
|
||||||
The default implementation does nothing.
|
The default implementation does nothing.
|
||||||
@@ -288,7 +288,7 @@ public:
|
|||||||
Thread safety:
|
Thread safety:
|
||||||
May be called from any thread.
|
May be called from any thread.
|
||||||
*/
|
*/
|
||||||
void start (Journal journal = Journal());
|
void start ();
|
||||||
|
|
||||||
/** Notify a root stoppable and children to stop, and block until stopped.
|
/** Notify a root stoppable and children to stop, and block until stopped.
|
||||||
Has no effect if the stoppable was already notified.
|
Has no effect if the stoppable was already notified.
|
||||||
@@ -304,7 +304,7 @@ public:
|
|||||||
Thread safety:
|
Thread safety:
|
||||||
Safe to call from any thread at any time.
|
Safe to call from any thread at any time.
|
||||||
*/
|
*/
|
||||||
void stopAsync (Journal journal = Journal());
|
void stopAsync ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Atomic <int> m_prepared;
|
Atomic <int> m_prepared;
|
||||||
|
|||||||
@@ -270,16 +270,16 @@ public:
|
|||||||
// Stoppable
|
// Stoppable
|
||||||
//
|
//
|
||||||
|
|
||||||
void onPrepare (Journal journal)
|
void onPrepare ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void onStart (Journal journal)
|
void onStart ()
|
||||||
{
|
{
|
||||||
startThread();
|
startThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onStop (Journal journal)
|
void onStop ()
|
||||||
{
|
{
|
||||||
if (this->Thread::isThreadRunning ())
|
if (this->Thread::isThreadRunning ())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -255,19 +255,19 @@ public:
|
|||||||
// Stoppable
|
// Stoppable
|
||||||
//
|
//
|
||||||
|
|
||||||
void onPrepare (Journal journal)
|
void onPrepare ()
|
||||||
{
|
{
|
||||||
#if RIPPLE_USE_NEW_VALIDATORS
|
#if RIPPLE_USE_NEW_VALIDATORS
|
||||||
journal.info << "Validators preparing";
|
m_journal.info << "Validators preparing";
|
||||||
|
|
||||||
addRPCHandlers();
|
addRPCHandlers();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void onStart (Journal journal)
|
void onStart ()
|
||||||
{
|
{
|
||||||
#if RIPPLE_USE_NEW_VALIDATORS
|
#if RIPPLE_USE_NEW_VALIDATORS
|
||||||
journal.info << "Validators starting";
|
m_journal.info << "Validators starting";
|
||||||
|
|
||||||
// Do this late so the sources have a chance to be added.
|
// Do this late so the sources have a chance to be added.
|
||||||
m_queue.dispatch (bind (&ManagerImp::setCheckSources, this));
|
m_queue.dispatch (bind (&ManagerImp::setCheckSources, this));
|
||||||
@@ -276,9 +276,9 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void onStop (Journal journal)
|
void onStop ()
|
||||||
{
|
{
|
||||||
journal.info << "Validators stopping";
|
m_journal.info << "Validators stopping";
|
||||||
|
|
||||||
if (this->Thread::isThreadRunning())
|
if (this->Thread::isThreadRunning())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -351,7 +351,7 @@ Json::Value InboundLedgers::getInfo()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InboundLedgers::onStop (Journal)
|
void InboundLedgers::onStop ()
|
||||||
{
|
{
|
||||||
ScopedLockType lock (mLock, __FILE__, __LINE__);
|
ScopedLockType lock (mLock, __FILE__, __LINE__);
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
void gotFetchPack (Job&);
|
void gotFetchPack (Job&);
|
||||||
void sweep ();
|
void sweep ();
|
||||||
|
|
||||||
void onStop (Journal);
|
void onStop ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef boost::unordered_map <uint256, InboundLedger::pointer> MapType;
|
typedef boost::unordered_map <uint256, InboundLedger::pointer> MapType;
|
||||||
|
|||||||
@@ -641,22 +641,22 @@ public:
|
|||||||
// Stoppable
|
// Stoppable
|
||||||
//
|
//
|
||||||
|
|
||||||
void onPrepare (Journal)
|
void onPrepare ()
|
||||||
{
|
{
|
||||||
prepareValidators ();
|
prepareValidators ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onStart (Journal journal)
|
void onStart ()
|
||||||
{
|
{
|
||||||
journal.debug << "Application starting";
|
m_journal.debug << "Application starting";
|
||||||
|
|
||||||
m_sweepTimer.setExpiration (10);
|
m_sweepTimer.setExpiration (10);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called to indicate shutdown.
|
// Called to indicate shutdown.
|
||||||
void onStop (Journal journal)
|
void onStop ()
|
||||||
{
|
{
|
||||||
journal.debug << "Application stopping";
|
m_journal.debug << "Application stopping";
|
||||||
|
|
||||||
m_sweepTimer.cancel();
|
m_sweepTimer.cancel();
|
||||||
|
|
||||||
@@ -679,8 +679,8 @@ public:
|
|||||||
// crash), the run() function will not get called and we will
|
// crash), the run() function will not get called and we will
|
||||||
// avoid doing silly things like contacting the SNTP server, or
|
// avoid doing silly things like contacting the SNTP server, or
|
||||||
// running the various logic threads like Validators, PeerFinder, etc.
|
// running the various logic threads like Validators, PeerFinder, etc.
|
||||||
prepare (m_journal);
|
prepare ();
|
||||||
start (m_journal);
|
start ();
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ IoServicePool::operator boost::asio::io_service& ()
|
|||||||
return m_service;
|
return m_service;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IoServicePool::onStop (Journal)
|
void IoServicePool::onStop ()
|
||||||
{
|
{
|
||||||
// VFALCO NOTE This is a hack! We should gracefully
|
// VFALCO NOTE This is a hack! We should gracefully
|
||||||
// cancel all pending I/O, and delete the work
|
// cancel all pending I/O, and delete the work
|
||||||
@@ -100,7 +100,7 @@ void IoServicePool::onStop (Journal)
|
|||||||
m_service.stop ();
|
m_service.stop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void IoServicePool::onChildrenStopped (Journal)
|
void IoServicePool::onChildrenStopped ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ public:
|
|||||||
boost::asio::io_service& getService ();
|
boost::asio::io_service& getService ();
|
||||||
operator boost::asio::io_service& ();
|
operator boost::asio::io_service& ();
|
||||||
|
|
||||||
void onStop (Journal);
|
void onStop ();
|
||||||
void onChildrenStopped (Journal);
|
void onChildrenStopped ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class ServiceThread;
|
class ServiceThread;
|
||||||
|
|||||||
@@ -155,21 +155,21 @@ public:
|
|||||||
// Stoppable
|
// Stoppable
|
||||||
//
|
//
|
||||||
|
|
||||||
void onPrepare (Journal)
|
void onPrepare ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void onStart (Journal journal)
|
void onStart ()
|
||||||
{
|
{
|
||||||
journal.debug << "Starting";
|
m_journal.debug << "Starting";
|
||||||
startThread ();
|
startThread ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onStop (Journal journal)
|
void onStop ()
|
||||||
{
|
{
|
||||||
if (isThreadRunning ())
|
if (isThreadRunning ())
|
||||||
{
|
{
|
||||||
journal.debug << "Stopping";
|
m_journal.debug << "Stopping";
|
||||||
stopThreadAsync ();
|
stopThreadAsync ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ NodeStoreScheduler::NodeStoreScheduler (Stoppable& parent, JobQueue& jobQueue)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeStoreScheduler::onStop (Journal)
|
void NodeStoreScheduler::onStop ()
|
||||||
{
|
{
|
||||||
if (--m_taskCount == 0)
|
if (--m_taskCount == 0)
|
||||||
stopped();
|
stopped();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeStoreScheduler::onChildrenStopped (Journal)
|
void NodeStoreScheduler::onChildrenStopped ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ class NodeStoreScheduler
|
|||||||
public:
|
public:
|
||||||
NodeStoreScheduler (Stoppable& parent, JobQueue& jobQueue);
|
NodeStoreScheduler (Stoppable& parent, JobQueue& jobQueue);
|
||||||
|
|
||||||
void onStop (Journal);
|
void onStop ();
|
||||||
void onChildrenStopped (Journal);
|
void onChildrenStopped ();
|
||||||
void scheduleTask (NodeStore::Task& task);
|
void scheduleTask (NodeStore::Task& task);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -92,12 +92,12 @@ public:
|
|||||||
// Stoppable
|
// Stoppable
|
||||||
//
|
//
|
||||||
|
|
||||||
void onStop (Journal)
|
void onStop ()
|
||||||
{
|
{
|
||||||
m_server.stopAsync();
|
m_server.stopAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onChildrenStopped (Journal)
|
void onChildrenStopped ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ public:
|
|||||||
//
|
//
|
||||||
// Stoppable
|
// Stoppable
|
||||||
|
|
||||||
void onStop (Journal)
|
void onStop ()
|
||||||
{
|
{
|
||||||
m_heartbeatTimer.cancel();
|
m_heartbeatTimer.cancel();
|
||||||
m_clusterTimer.cancel();
|
m_clusterTimer.cancel();
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public:
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
void onStop (Journal)
|
void onStop ()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
boost::system::error_code ec;
|
boost::system::error_code ec;
|
||||||
|
|||||||
@@ -202,20 +202,20 @@ public:
|
|||||||
// Stoppable
|
// Stoppable
|
||||||
//
|
//
|
||||||
|
|
||||||
void onPrepare (Journal)
|
void onPrepare ()
|
||||||
{
|
{
|
||||||
preparePeerFinder();
|
preparePeerFinder();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onStart (Journal)
|
void onStart ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void onStop (Journal)
|
void onStop ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void onChildrenStopped (Journal)
|
void onChildrenStopped ()
|
||||||
{
|
{
|
||||||
// VFALCO TODO Clean this up and do it right, based on sockets
|
// VFALCO TODO Clean this up and do it right, based on sockets
|
||||||
stopped();
|
stopped();
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public:
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
void onStop (Journal)
|
void onStop ()
|
||||||
{
|
{
|
||||||
m_fetchTimer.cancel ();
|
m_fetchTimer.cancel ();
|
||||||
m_scoreTimer.cancel ();
|
m_scoreTimer.cancel ();
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ private:
|
|||||||
stopped ();
|
stopped ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onStop (Journal)
|
void onStop ()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
ScopedLockType lock (m_endpointLock, __FILE__, __LINE__);
|
ScopedLockType lock (m_endpointLock, __FILE__, __LINE__);
|
||||||
|
|||||||
@@ -645,7 +645,7 @@ private:
|
|||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
void onStop (Journal)
|
void onStop ()
|
||||||
{
|
{
|
||||||
// VFALCO NOTE I wanted to remove all the jobs that are skippable
|
// VFALCO NOTE I wanted to remove all the jobs that are skippable
|
||||||
// but then the Workers count of tasks to process
|
// but then the Workers count of tasks to process
|
||||||
@@ -697,7 +697,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void onChildrenStopped (Journal)
|
void onChildrenStopped ()
|
||||||
{
|
{
|
||||||
ScopedLock lock (m_mutex);
|
ScopedLock lock (m_mutex);
|
||||||
|
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ public:
|
|||||||
stopped ();
|
stopped ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onStop (Journal)
|
void onStop ()
|
||||||
{
|
{
|
||||||
// HACK!
|
// HACK!
|
||||||
m_io_service.stop ();
|
m_io_service.stop ();
|
||||||
|
|||||||
Reference in New Issue
Block a user