|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.jini.start.config.ServiceConfiguration.AbstractServiceStarter<V>
com.bigdata.jini.start.config.JavaServiceConfiguration.JavaServiceStarter<V>
com.bigdata.jini.start.config.ManagedServiceConfiguration.ManagedServiceStarter<V>
com.bigdata.jini.start.config.JiniServiceConfiguration.JiniServiceStarter<V>
V - public class JiniServiceConfiguration.JiniServiceStarter<V extends JiniServiceProcessHelper>
| Field Summary |
|---|
| Fields inherited from class com.bigdata.jini.start.config.ManagedServiceConfiguration.ManagedServiceStarter |
|---|
fed, logicalServiceZNode, logicalServiceZPath, restart, serviceDir, serviceName, serviceUUID |
| Fields inherited from class com.bigdata.jini.start.config.JavaServiceConfiguration.JavaServiceStarter |
|---|
cls |
| Fields inherited from class com.bigdata.jini.start.config.ServiceConfiguration.AbstractServiceStarter |
|---|
listener |
| Constructor Summary | |
|---|---|
protected |
JiniServiceConfiguration.JiniServiceStarter(JiniFederation fed,
IServiceListener listener,
String logicalServiceZPath,
net.jini.core.entry.Entry[] attributes)
|
| Method Summary | |
|---|---|
protected void |
addServiceOptions(List<String> cmds)
Extended to specify the configuration file (in the service directory) as an argument to the java class whose main routine will be invoked and to add the JiniServiceConfiguration.Options.JINI_OPTIONS. |
protected net.jini.core.lookup.ServiceItem |
awaitServiceDiscoveryOrDeath(ProcessHelper processHelper,
long timeout,
TimeUnit unit)
Waits up to timeout units for the service to either by discovered by jini or to die. |
protected void |
awaitServiceStart(V processHelper,
long timeout,
TimeUnit unit)
Overridden to monitor for the jini join of the service and the creation of the znode corresponding to the physical service instance. |
void |
awaitZNodeCreatedOrDeath(net.jini.core.lookup.ServiceItem serviceItem,
ProcessHelper processHelper,
long timeout,
TimeUnit unit)
Waits up to timeout units for the znode for the physical service to be created or the process to die. |
protected net.jini.core.entry.Entry[] |
getEntries(net.jini.core.entry.Entry[] entries)
Returns the Entry[] used to describe the service (allows the
override or addition of entries at service creation time). |
String[] |
getImports()
Imports that will be written into the generated ConfigurationFile. |
protected Properties |
getProperties(Properties properties)
Extension hook for adding or overriding properties. |
protected V |
newProcessHelper(String className,
ProcessBuilder processBuilder,
IServiceListener listener)
Return the ProcessHelper that will be used to manage the
process. |
protected void |
setUp()
Extended to write the Configuration file in the service
directory. |
protected void |
writeComments(Writer out)
Write comments at the top of the configuration file. |
protected void |
writeConfigFile()
Generates the contents of the configuration file and writes it on the configFile. |
protected void |
writeConfigFile(Writer out)
Generates the contents of the configuration file. |
protected void |
writeEntries(Writer out)
|
protected void |
writeEntry(Writer out,
net.jini.core.entry.Entry e)
Write out the ctor for an Entry. |
protected void |
writeExporterEntry(Writer out)
Writes the AbstractServer.ConfigurationOptions#SERVICE_ID_FILE entry. |
protected void |
writeGroups(Writer out)
|
protected void |
writeLocators(Writer out)
|
protected void |
writeLogicalServiceZPathEntry(Writer out)
Writes the AbstractServer.ConfigurationOptions#LOGICAL_SERVICE_ZPATH
entry. |
protected void |
writeProperties(Writer out)
Writes the properties for the specificed class namespace into the generated service configuration file. |
protected void |
writeServiceDescription(Writer out)
Writes the ServiceDescription. |
protected void |
writeServiceDirEntry(Writer out)
Writes the AbstractServer.ConfigurationOptions#SERVICE_DIR
entry. |
protected void |
writeZookeeperClientConfigEntries(Writer out)
Writes the ZookeeperClientConfig into the configuration file. |
| Methods inherited from class com.bigdata.jini.start.config.ManagedServiceConfiguration.ManagedServiceStarter |
|---|
getServiceDir |
| Methods inherited from class com.bigdata.jini.start.config.JavaServiceConfiguration.JavaServiceStarter |
|---|
addCommand, addCommandArgs, setUpEnvironment |
| Methods inherited from class com.bigdata.jini.start.config.ServiceConfiguration.AbstractServiceStarter |
|---|
call, getCommandLine, newProcessBuilder, newProcessBuilder, writeStartFile |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected JiniServiceConfiguration.JiniServiceStarter(JiniFederation fed,
IServiceListener listener,
String logicalServiceZPath,
net.jini.core.entry.Entry[] attributes)
fed - listener - logicalServiceZPath - This zpath of the logicalService instance.attributes - This provides the information required to restart a
persistent service. When not given a new service instance
will be started. When given, the same service instance
will be restarted.| Method Detail |
|---|
public String[] getImports()
ConfigurationFile.
Configuration uses fully qualified
imports so it may be that we don't need any of these.protected void addServiceOptions(List<String> cmds)
JiniServiceConfiguration.Options.JINI_OPTIONS.
addServiceOptions in class ServiceConfiguration.AbstractServiceStarter<V extends JiniServiceProcessHelper>
protected void setUp()
throws Exception
Configuration file in the service
directory.
Note: If this is a service restart then Configuration is NOT
overwritten. If you want to change the Configuration of a
service which has already been started you need to either administer
it through jini or shut it down and edit its configuration file.
setUp in class ManagedServiceConfiguration.ManagedServiceStarter<V extends JiniServiceProcessHelper>Exception
protected void writeConfigFile()
throws IOException
configFile.
IOException
protected void writeConfigFile(Writer out)
throws IOException
out -
IOException
protected void writeComments(Writer out)
throws IOException
IOException
protected net.jini.core.entry.Entry[] getEntries(net.jini.core.entry.Entry[] entries)
throws IOException
Entry[] used to describe the service (allows the
override or addition of entries at service creation time). The
following attributes are added:
NameName entry. It is formed from the service
type and the logical service znode.HostnameServiceDirServiceUUIDServiceID assigned to the service represented as a
UUID.
IOException
protected void writeEntries(Writer out)
throws IOException
out -
IOException
protected void writeEntry(Writer out,
net.jini.core.entry.Entry e)
throws IOException
Entry. For example, generating
new net.jini.lookup.entry.Name("foo") when given a
Name.
Note: There is no general purpose mechanism for emitting
Entry attributes using reflection, even when the
Entry is an AbstractEntry (ctors do not declare the
relationship between their arguments and the public fields). Further,
jini will not let you use the zero arg public ctor and then set the
fields from the public fields declared by the Entry class from within
the generated configuration file. For example,
_entry1.name = "foo"; is rejected by the
ConfigurationProvider. This unpleasant situation means that
we are hardcoding the ctor calls based on the class. However, you can
use this method as a hook to extend the logic to handle Entry
implementations which it does not already understand.
UnsupportedOperationException - if it can not emit an entry of some unknown class.
IOException
protected void writeGroups(Writer out)
throws IOException
IOException
protected void writeLocators(Writer out)
throws IOException
IOException
protected void writeServiceDescription(Writer out)
throws IOException
exporter, serviceIdFile, and
logicalServiceZPath entries.
IOException
protected void writeProperties(Writer out)
throws IOException
writer -
IOExceptionprotected Properties getProperties(Properties properties)
properties - The configured properties.
writeProperties(Writer)
protected void writeExporterEntry(Writer out)
throws IOException
AbstractServer.ConfigurationOptions#SERVICE_ID_FILE entry.
This value is used by the AbstractServer to export the proxy
for the service. The choice here effects the protocol that will be
used for communications between the clients and the service.
FIXME the [exporter] is hardwired. There are also hardwired exporters
used by the JiniFederation. The whole issue needs to be
resolved. The exported is a chunk of code, so it would have to be
quoted to get passed along, which is why I am doing it this way.
IOException
protected void writeServiceDirEntry(Writer out)
throws IOException
AbstractServer.ConfigurationOptions#SERVICE_DIR
entry.
IOException
protected void writeLogicalServiceZPathEntry(Writer out)
throws IOException
AbstractServer.ConfigurationOptions#LOGICAL_SERVICE_ZPATH
entry. The service must use CreateMode.EPHEMERAL_SEQUENTIAL
to create a child of this zpath to represent itself.
IOException
protected void writeZookeeperClientConfigEntries(Writer out)
throws IOException
ZookeeperClientConfig into the configuration file.
IOException
protected V newProcessHelper(String className,
ProcessBuilder processBuilder,
IServiceListener listener)
throws IOException
ServiceConfiguration.AbstractServiceStarterProcessHelper that will be used to manage the
process.
newProcessHelper in class ServiceConfiguration.AbstractServiceStarter<V extends JiniServiceProcessHelper>IOException
protected void awaitServiceStart(V processHelper,
long timeout,
TimeUnit unit)
throws Exception,
TimeoutException,
InterruptedException
awaitServiceStart in class ServiceConfiguration.AbstractServiceStarter<V extends JiniServiceProcessHelper>Exception - If a service start failure could be detected (the caller
will kill the process and log an error if any exception
is thrown).
TimeoutException
InterruptedException
protected net.jini.core.lookup.ServiceItem awaitServiceDiscoveryOrDeath(ProcessHelper processHelper,
long timeout,
TimeUnit unit)
throws Exception,
TimeoutException,
InterruptedException
Note: We recognize the service by the present of the assigned
ServiceToken attribute. If a service with that
ServiceToken can not be discovered by jini after a timeout,
then we presume that the service could not start and throw an
exception. The ServiceToken provides an attribute which is
assigned by the service starter while the ServiceID is
assigned by jini only after the service has joined with a jini
registrar.
processHelper - timeout - unit -
ServiceItem for the discovered service.
Exception
TimeoutException
InterruptedException
public void awaitZNodeCreatedOrDeath(net.jini.core.lookup.ServiceItem serviceItem,
ProcessHelper processHelper,
long timeout,
TimeUnit unit)
throws org.apache.zookeeper.KeeperException,
InterruptedException,
TimeoutException
processHelper - timeout - unit -
TimeoutException
InterruptedException
org.apache.zookeeper.KeeperException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||