@ThreadSafe public final class VoteServer.Run extends Object
Modifier and Type | Field and Description |
---|---|
AtomicReference<Thread> |
constructionThreadA |
(package private) ReentrantLock |
singleServiceLock |
Constructor and Description |
---|
VoteServer.Run(boolean isSingleThreaded)
Constructs a Run.
|
Modifier and Type | Method and Description |
---|---|
Database |
database()
The vote-server's relational database.
|
Geocode.Table |
geocodeTable()
The relational cache of geocoded residential addresses.
|
void |
init_done()
Records that initialization is complete - that no further calls will be made
to init_ methods.
|
<S extends VoterService> |
init_ensureVoterService(File startupConfigurationFile,
Class<S> serviceClass)
Returns a voter service, creating it if necessary and storing it for later
retrieval.
|
void |
init_putVoterService(VoterService service)
Stores a voter service in this run, for later retrieval.
|
boolean |
isSingleThreaded()
Returns true if this run is restricted to a single client thread, false if
multiple client threads are allowed.
|
VoterService[] |
newVoterServiceArray()
Returns all non-poll voter services provided in this run.
|
PollService.VoteServerScope.Run |
scopePoll()
API for all polls within the scope of this vote-server run.
|
ReentrantLock |
singleServiceLock()
Returns the thread access lock shared by all services; or null if all services
do not share the same lock.
|
Trustserver |
trustserver()
The trustserver for this vote-server.
|
UserSettings.Table |
userTable()
The relational store of service preferences and other settings,
for the users of this vote-server.
|
VoterService |
voterService(String name)
Returns a non-poll voter service provided in this run; or null if the name
designates no provided non-poll service.
|
VoteServer |
voteServer()
The vote-server for this run.
|
@Warning(value="non-API") public final AtomicReference<Thread> constructionThreadA
final ReentrantLock singleServiceLock
public VoteServer.Run(boolean isSingleThreaded) throws IOException, ScriptException, SQLException
isSingleThreaded
- per isSingleThreaded() -
if false (multi-threaded), the client should call
init_done() after initialization is complete.IOException
ScriptException
SQLException
public void init_done()
@ThreadRestricted(value="constructor") public <S extends VoterService> S init_ensureVoterService(File startupConfigurationFile, Class<S> serviceClass) throws IOException, ScriptException, SQLException
startupConfigurationFile
- the startup configuration file for the service.serviceClass
- the class of the service.VoterService.NoSuchServiceException
- if startupConfigurationFile
does not exist.IOException
ScriptException
SQLException
init_putVoterService(VoterService)
,
voterService(String)
@ThreadRestricted(value="constructor") public void init_putVoterService(VoterService service)
IllegalStateException
- if an instance
of the same service was already stored.voterService(String)
@Warning(value="thread restricted object") public Database database()
public Geocode.Table geocodeTable()
public boolean isSingleThreaded()
public VoterService[] newVoterServiceArray()
voterService(String)
public VoteServer voteServer()
public PollService.VoteServerScope.Run scopePoll()
public ReentrantLock singleServiceLock()
VoterService.lock()
@Warning(value="thread restricted object") public Trustserver trustserver()
@Warning(value="thread restricted object") public UserSettings.Table userTable()
public VoterService voterService(String name) throws IOException, ScriptException, SQLException
name
- per VoterService.name().IOException
ScriptException
SQLException
VoterService.isNonPoll(String)
,
init_ensureVoterService(File,Class)
,
newVoterServiceArray()
,
PollService.VoteServerScope.Run.ensurePoll(String)