public abstract class AbstractCamelClusterService<T extends CamelClusterView> extends ServiceSupport implements CamelClusterService
CamelClusterService.Selectorshutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending| Modifier | Constructor and Description |
|---|---|
protected |
AbstractCamelClusterService() |
protected |
AbstractCamelClusterService(String id) |
protected |
AbstractCamelClusterService(String id,
CamelContext camelContext) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract T |
createView(String namespace) |
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
Map<String,Object> |
getAttributes()
Attributes associated to the service.
|
CamelContext |
getCamelContext()
Get the
CamelContext |
String |
getId()
Returns the id
|
Collection<String> |
getNamespaces()
Return the namespaces handled by this service.
|
int |
getOrder()
Gets the order.
|
CamelClusterView |
getView(String namespace)
Get a view of the cluster bound to a namespace creating it if needed.
|
boolean |
isLeader(String namespace)
Check if the service is the leader on the given namespace.
|
void |
releaseView(CamelClusterView view)
Release a view if it has no references.
|
void |
setAttribute(String key,
Object value) |
void |
setAttributes(Map<String,Object> attributes) |
void |
setCamelContext(CamelContext camelContext)
Injects the
CamelContext |
void |
setId(String id)
Sets the id
|
void |
setOrder(int order) |
void |
startView(String namespace)
Force start of the view associated to the give namespace.
|
void |
stopView(String namespace)
Force stop of the view associated to the give namespace.
|
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitunwrapprotected AbstractCamelClusterService()
protected AbstractCamelClusterService(String id)
protected AbstractCamelClusterService(String id, CamelContext camelContext)
public int getOrder()
OrderedInteger.MAX_VALUE or eg Ordered.LOWEST.getOrder in interface CamelClusterServicegetOrder in interface Orderedpublic void setOrder(int order)
public void setCamelContext(CamelContext camelContext)
CamelContextAwareCamelContextsetCamelContext in interface CamelContextAwarecamelContext - the Camel contextpublic CamelContext getCamelContext()
CamelContextAwareCamelContextgetCamelContext in interface CamelContextAwarepublic void setAttributes(Map<String,Object> attributes)
public void setAttribute(String key, Object value)
public Map<String,Object> getAttributes()
CamelClusterServicegetAttributes in interface CamelClusterServiceprotected void doStart() throws Exception
ServiceSupportServiceSupport.doStop() for more details.doStart in class ServiceSupportExceptionServiceSupport.doStop()protected void doStop() throws Exception
ServiceSupportServiceSupport.doStop() method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext is shutting down.doStop in class ServiceSupportExceptionServiceSupport.doStart()public CamelClusterView getView(String namespace) throws Exception
CamelClusterServicegetView in interface CamelClusterServicenamespace - the namespace the view refer to.Exception - if the view can't be created.public void releaseView(CamelClusterView view) throws Exception
CamelClusterServicereleaseView in interface CamelClusterServiceview - the view.Exceptionpublic Collection<String> getNamespaces()
CamelClusterServicegetNamespaces in interface CamelClusterServicepublic void startView(String namespace) throws Exception
CamelClusterServicestartView in interface CamelClusterServiceExceptionpublic void stopView(String namespace) throws Exception
CamelClusterServicestopView in interface CamelClusterServiceExceptionpublic boolean isLeader(String namespace)
CamelClusterServiceisLeader in interface CamelClusterServicenamespace - the namespace.protected abstract T createView(String namespace) throws Exception
ExceptionApache Camel