Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign stoppable objects #3741

Closed
wants to merge 66 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
0747c09
Remove Stoppable::onPrepare
thejohnfreeman Dec 29, 2020
73e6347
[fold] Move timer from RootStoppable to LoadManager
thejohnfreeman Dec 29, 2020
6b56845
[fold] Call stopped() in LedgerCleanerImp::onStop
thejohnfreeman Dec 30, 2020
2180d82
[fold] Remove Stoppable from base classes of OrderBookDB, LedgerMaster
thejohnfreeman Dec 30, 2020
e8f8d04
[fold] Call stopped() in SHAMapStoreImp::onStop
thejohnfreeman Dec 30, 2020
0282848
[fold] Call stopped() in NodeStore::Database::onStop
thejohnfreeman Dec 30, 2020
50a9967
[fold] NodeStoreScheduler is not a Stoppable
thejohnfreeman Dec 30, 2020
9af6acc
[fold] Call stopped() in ServerHandlerImp::onStop
thejohnfreeman Dec 30, 2020
1bb43f7
[fold] Stop NodeStore::TaskQueue from NodeStore::DatabaseShardImp::on…
thejohnfreeman Dec 30, 2020
94c830c
[fold] Move JobCounter from RootStoppable to JobQueue
thejohnfreeman Dec 31, 2020
ef7d968
[fold] Call stopped() in OverlayImpl::onStop
thejohnfreeman Dec 31, 2020
c27f440
[fold] Call stopped() in NodeStore::DatabaseShardImp::onStop
thejohnfreeman Dec 31, 2020
aad8a32
[fold] Call stopped() in PerfLogImp::onStop
thejohnfreeman Dec 31, 2020
59557fe
[fold] Remove Stoppable::{stopped,onChildrenStopped}
thejohnfreeman Dec 31, 2020
78050db
[fold] Remove Stoppable::{setParent,getRoot}
thejohnfreeman Dec 31, 2020
251bf3e
[fold] Remove RootStoppable::start and Stoppable::startRecursive
thejohnfreeman Jan 5, 2021
299e059
[fold] Inline Application::start
thejohnfreeman Jan 6, 2021
ad12f0e
[fold] LoadManager is not a Stoppable
thejohnfreeman Jan 6, 2021
ffa6c2c
[fold] PeerFinder::Manager is not a Stoppable
thejohnfreeman Jan 6, 2021
4d32cf6
[fold] Remove unused include
thejohnfreeman Jan 6, 2021
f331b3f
[fold] ServerHandlerImp is not a Stoppable
thejohnfreeman Jan 6, 2021
f8bd287
[fold] LedgerCleaner is not a Stoppable
thejohnfreeman Jan 6, 2021
15a9472
[fold] NetworkOPsImp is not a Stoppable
thejohnfreeman Jan 6, 2021
eb68656
[fold] Remove unused include
thejohnfreeman Jan 6, 2021
2d26155
[fold] GRPCServer is not a Stoppable
thejohnfreeman Jan 6, 2021
727b349
[fold] PerfLogImp is not a Stoppable
thejohnfreeman Jan 7, 2021
3e08270
[fold] Use a fixture for PerfLog tests
thejohnfreeman Jan 7, 2021
15b7da1
[fold] OverlayImpl is not a Stoppable
thejohnfreeman Jan 8, 2021
4a150d1
[fold] InboundTransactionsImp is not a Stoppable
thejohnfreeman Jan 8, 2021
2b35d46
[fold] InboundLedgersImp is not a Stoppable
thejohnfreeman Jan 8, 2021
833767e
[fold] ReportingETL is not a Stoppable
thejohnfreeman Jan 22, 2021
77a6ac7
[fold] PgPool is not a Stoppable
thejohnfreeman Jan 22, 2021
8c5deef
[fold] NodeStore::Database is not a Stoppable
thejohnfreeman Jan 18, 2021
023998b
[fold] SHAMapStoreImp is not a Stoppable
thejohnfreeman Jan 19, 2021
21db979
[fold] ShardArchiveHandler is not a Stoppable
thejohnfreeman Jan 19, 2021
0b14202
[fold] JobQueue is not a Stoppable
thejohnfreeman Jan 19, 2021
fe5d5db
[fold] Remove Stoppable
thejohnfreeman Jan 19, 2021
ddf177e
[fold] Document ClosureCounter and Workers
thejohnfreeman Jan 19, 2021
846b0c7
[fold] Remove mentions of Stoppable
thejohnfreeman Jan 19, 2021
6a45a85
[fold] Rename HTTPDownloader::{onStop -> stop}
thejohnfreeman Jan 19, 2021
5e892a7
[fold] review fixes
thejohnfreeman Jan 26, 2021
cd9cd6e
[fold] Merge 1.7.0-b12
thejohnfreeman Jan 27, 2021
e8a8d3e
[fold] LedgerReplayer is not a Stoppable
thejohnfreeman Jan 27, 2021
bd22635
[fold] Use CTAD
thejohnfreeman Jan 31, 2021
a40ddf2
[fold] Move start, stop to PerfLog interface and use it
thejohnfreeman Jan 31, 2021
6fe6f26
[fold] Prefer narrow capture list
thejohnfreeman Jan 31, 2021
905a274
[fold] Rename Timer::{start -> async_wait}
thejohnfreeman Jan 31, 2021
f556e07
[fold] Move start, stop to Overlay interface and use it
thejohnfreeman Jan 31, 2021
a4fbb6c
[fold] Stop at the beginning of every NodeStore::Database destructor
thejohnfreeman Feb 1, 2021
954c6fb
[fold] Rename Workers::{pauseAllThreadsAndWait -> stop}
thejohnfreeman Feb 1, 2021
3596ce5
[fold] Ignore overlay when it is missing
thejohnfreeman Feb 1, 2021
fcba4a6
[fold] Fix comment
thejohnfreeman Feb 2, 2021
92e9c6a
[fold] Stop ServerHandlerImp
thejohnfreeman Feb 3, 2021
01521e5
[fold] Rearrange stop sequence
thejohnfreeman Feb 7, 2021
5e05663
Merge 1.7.0-rc2
thejohnfreeman Feb 7, 2021
6a025ff
Fix declaration of CassandraBackend::counters_
thejohnfreeman Feb 5, 2021
51adc26
[fold] review fixes
thejohnfreeman Feb 8, 2021
e531354
[fold] Move LedgerCleaner from LedgerMaster to ApplicationImp
thejohnfreeman Feb 8, 2021
5bfc16f
[fold] Merge 1.8.0-b1
thejohnfreeman Mar 15, 2021
2a39b7c
[fold] Add missing include
thejohnfreeman Mar 23, 2021
d3c1c1f
Fix compilation of krb5 dependency with GCC 10
thejohnfreeman Mar 23, 2021
e74afc3
Merge 1.8.0-b2
thejohnfreeman Apr 2, 2021
f1beb4f
[fold] Put PgPool behind conditional compilation
thejohnfreeman Apr 2, 2021
145f5a1
[fold] More conditional compilation
thejohnfreeman Apr 2, 2021
220f440
[fold] Requested changes
thejohnfreeman Apr 30, 2021
7b459ca
[fold] Requested changes
thejohnfreeman May 13, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions src/ripple/app/misc/SHAMapStoreImp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ SHAMapStoreImp::run()
rendezvous_.notify_all();
if (stop_)
{
stopped();
return;
}
cond_.wait(lock);
Expand Down Expand Up @@ -759,22 +758,16 @@ SHAMapStoreImp::health()
void
SHAMapStoreImp::onStop()
{
// This is really a check for `if (thread_)`.
if (deleteInterval_)
if (thread_.joinable())
{
{
std::lock_guard lock(mutex_);
stop_ = true;
cond_.notify_one();
}
cond_.notify_one();
// stopped() will be called by the thread_ running run(),
// when it reaches the check for stop_.
}
else
{
// There is no thread running run(), so we must call stopped().
stopped();
thread_.join();
}
stopped();
}

boost::optional<LedgerIndex>
Expand Down
11 changes: 0 additions & 11 deletions src/ripple/app/misc/SHAMapStoreImp.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,6 @@ class SHAMapStoreImp : public Stoppable, public SHAMapStore
NodeStore::Scheduler& scheduler,
beast::Journal journal);

~SHAMapStoreImp()
{
if (thread_.joinable())
thread_.join();
}
ximinez marked this conversation as resolved.
Show resolved Hide resolved

std::uint32_t
clampFetchDepth(std::uint32_t fetch_depth) const override
{
Expand Down Expand Up @@ -248,20 +242,15 @@ class SHAMapStoreImp : public Stoppable, public SHAMapStore
Health
health();

//
// Stoppable
//
void
onStart() override
{
if (deleteInterval_)
thread_ = std::thread(&SHAMapStoreImp::run, this);
}

// Called when the application begins shutdown
void
onStop() override;
// Called when all child Stoppable objects have stoped
};

} // namespace ripple
Expand Down