- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.fabric3.spi.federation.ZoneTopologyService
类的一些代码示例,展示了ZoneTopologyService
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZoneTopologyService
类的具体详情如下:
包路径:org.fabric3.spi.federation.ZoneTopologyService
类名称:ZoneTopologyService
暂无
代码示例来源:origin: org.codehaus.fabric3/fabric3-binding-zeromq
@Destroy
public void destroy() throws ZoneChannelException {
topologyService.closeChannel(qualifiedChannelName);
topologyService.deregister(this);
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-binding-zeromq
@Init
public void init() throws MessageException {
topologyService.register(this);
topologyService.openChannel(qualifiedChannelName, null, this);
AddressRequest request = new AddressRequest(info.getRuntimeName());
topologyService.sendAsynchronous(qualifiedChannelName, request);
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-jetty
/**
* Registers HTTP and HTTPS metadata with the topology service if it is available.
*
* @throws UnknownHostException if there is an error retrieving the host address
*/
private void registerHttpMetadata() throws UnknownHostException {
if (topologyService != null) {
topologyService.registerMetadata(FederationConstants.HTTP_PORT_METADATA, selectedHttp.getNumber());
String host = httpConnector.getHost();
if (host == null) {
host = InetAddress.getLocalHost().getHostAddress();
}
topologyService.registerMetadata(FederationConstants.HTTP_HOST_METADATA, host);
if (isHttpsEnabled()) {
topologyService.registerMetadata(FederationConstants.HTTPS_PORT_METADATA, selectedHttps.getNumber());
}
}
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-timer
public void start() throws ComponentException {
super.start();
if (Scope.DOMAIN.equals(scope)) {
if (topologyService != null) {
topologyService.register(this);
}
if (RuntimeMode.PARTICIPANT == info.getRuntimeMode() && !topologyService.isZoneLeader()) {
// defer scheduling until this node becomes zone leader
return;
}
}
if (scheduleOnStart) {
// only schedule on start if the runtime has started. If the runtime has not yet started, {@link #schedule} will be called externally on start.
schedule();
}
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-channel-impl
public void handle(Object event, boolean endOfBatch) {
if (!(event instanceof EventWrapper) && event instanceof Serializable) {
// check for EventWrapper to avoid re-replicating an event that was just replicated
try {
topologyService.sendAsynchronous(channelName, (Serializable) event);
} catch (MessageException e) {
monitor.error(e);
}
}
// pass the object to the head stream handler
next.handle(event, endOfBatch);
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-timer
public void onLeaderElected(String name) {
if (!Scope.DOMAIN.equals(scope)) {
return;
}
if (topologyService != null && !topologyService.isZoneLeader()) {
// this runtime is not the leader, ignore
return;
}
// this runtime was elected leader, schedule the components
schedule();
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-channel-impl
public Channel build(PhysicalChannelDefinition definition) throws BuilderException {
URI uri = definition.getUri();
QName deployable = definition.getDeployable();
FanOutHandler fanOutHandler;
if (definition.getBindingDefinition() != null) {
// if a binding is set on the channel, make the channel synchronous since async behavior will be provided by the binding
fanOutHandler = new SyncFanOutHandler();
} else {
// the channel is local, have it implement asynchrony
fanOutHandler = new AsyncFanOutHandler(executorService);
}
Channel channel;
if (definition.isReplicate() && replicationCapable) {
String channelName = uri.toString();
ReplicationHandler replicationHandler = new ReplicationHandler(channelName, topologyService, monitor);
channel = new DefaultChannelImpl(uri, deployable, replicationHandler, fanOutHandler, definition.getChannelSide());
if (!topologyService.isChannelOpen(channelName)) {
try {
topologyService.openChannel(channelName, null, replicationHandler);
} catch (ZoneChannelException e) {
throw new BuilderException(e);
}
}
} else {
channel = new DefaultChannelImpl(uri, deployable, fanOutHandler, definition.getChannelSide());
}
PhysicalChannelBindingDefinition bindingDefinition = definition.getBindingDefinition();
buildBinding(channel, bindingDefinition);
return channel;
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-timer
public void stop() throws ComponentException {
super.stop();
if (topologyService != null && Scope.DOMAIN.equals(scope)) {
topologyService.deregister(this);
}
if (future != null && !future.isCancelled() && !future.isDone()) {
future.cancel(true);
}
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-channel-impl
public void dispose(PhysicalChannelDefinition definition, Channel channel) throws BuilderException {
URI uri = definition.getUri();
if (definition.isReplicate() && replicationCapable) {
String channelName = uri.toString();
try {
topologyService.closeChannel(channelName);
} catch (ZoneChannelException e) {
throw new BuilderException(e);
}
}
disposeBinding(channel, definition.getBindingDefinition());
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-channel-impl
@Reference(required = false)
public void setTopologyService(List<ZoneTopologyService> services) {
// use a collection to force reinjection
if (services != null && !services.isEmpty()) {
this.topologyService = services.get(0);
replicationCapable = topologyService.supportsDynamicChannels();
}
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-binding-zeromq
@Override
public void publish(AddressEvent event) {
if (event instanceof AddressAnnouncement) {
try {
topologyService.sendAsynchronous(qualifiedChannelName, event);
super.publish(event);
} catch (MessageException e) {
e.printStackTrace();
// TODO monitor
}
}
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-fabric
public void startContext(QName deployable) throws GroupInitializationException {
if (RuntimeMode.PARTICIPANT == info.getRuntimeMode() && topologyService == null) {
return;
} else if (RuntimeMode.PARTICIPANT == info.getRuntimeMode() && !topologyService.isZoneLeader()) {
// defer instantiation until this node becomes zone leader
synchronized (deferredContexts) {
deferredContexts.add(deployable);
}
return;
}
activated = true;
super.startContext(deployable);
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-binding-zeromq
public void onMessage(Object object) {
if (object instanceof AddressAnnouncement) {
super.publish((AddressAnnouncement) object);
} else if (object instanceof AddressUpdate) {
AddressUpdate update = (AddressUpdate) object;
for (AddressAnnouncement announcement : update.getAnnouncements()) {
super.publish(announcement);
}
} else if (object instanceof AddressRequest) {
AddressRequest request = (AddressRequest) object;
AddressUpdate update = new AddressUpdate();
for (Map.Entry<String, List<SocketAddress>> entry : addresses.entrySet()) {
for (SocketAddress address : entry.getValue()) {
if (info.getRuntimeName().equals(address.getRuntimeName())) {
AddressAnnouncement announcement = new AddressAnnouncement(entry.getKey(), AddressAnnouncement.Type.ACTIVATED, address);
update.addAnnouncement(announcement);
}
}
}
if (!update.getAnnouncements().isEmpty()) {
try {
topologyService.sendAsynchronous(request.getRuntimeName(), qualifiedChannelName, update);
} catch (MessageException e) {
e.printStackTrace();
// TODO monitor
}
}
}
}
代码示例来源:origin: org.codehaus.fabric3/fabric3-fabric
public void onLeaderElected(String name) {
if (topologyService != null && !topologyService.isZoneLeader()) {
// this runtime is not the leader, ignore
return;
}
activated = true;
// this runtime was elected leader, start the components
synchronized (deferredContexts) {
WorkContextCache.getAndResetThreadWorkContext();
for (QName deployable : deferredContexts) {
try {
super.startContext(deployable);
} catch (GroupInitializationException e) {
monitor.leaderElectionError(e);
}
}
deferredContexts.clear();
}
}
本文整理了Java中org.fabric3.spi.federation.ZoneTopologyService.deregister()方法的一些代码示例,展示了ZoneTopologyServic
本文整理了Java中org.fabric3.spi.federation.ZoneTopologyService.openChannel()方法的一些代码示例,展示了ZoneTopologyServi
本文整理了Java中org.fabric3.spi.federation.ZoneTopologyService.closeChannel()方法的一些代码示例,展示了ZoneTopologyServ
我是一名优秀的程序员,十分优秀!