@Override public MessagingChannel newMessagingChannel(String id, String uri) { return newMessagingChannel(defaultChannelType, id, uri); }
@Override public RemotingChannel newRemotingChannel(String id, ServerApp serverApp) { return newRemotingChannel(id, serverApp, RemotingChannel.DEFAULT_MAX_CONCURRENT_REQUESTS); }
public void stop() { aliasRegistry = null; stop(true); }
@Override public RemotingChannel newRemotingChannel(String id, URI uri, int maxConcurrentRequests) { if (getRemotingTransport() == null) throw new RuntimeException("Remoting transport not defined, start the ChannelFactory first"); if (!getRemotingTransport().isStarted() && !getRemotingTransport().start()) throw new TransportException("Could not start remoting transport: " + getRemotingTransport()); RemotingChannel channel = defaultChannelBuilder.buildRemotingChannel(getRemotingChannelClass(), id, uri, maxConcurrentRequests, getRemotingTransport(), newMessagingCodec(AMF0Message.class)); if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; }
@Override public MessagingChannel newMessagingChannel(String channelType, String id, URI uri) { Transport transport = getMessagingTransport(channelType); if (transport == null) throw new RuntimeException("No transport defined for channel type " + channelType + ", start the ChannelFactory first"); if (!transport.isStarted() && !transport.start()) throw new TransportException("Could not start messaging transport: " + transport); MessagingCodec<Message[]> codec = newMessagingCodec(Message[].class); for (ChannelBuilder builder : ServiceLoader.load(ChannelBuilder.class)) { MessagingChannel channel = builder.buildMessagingChannel(channelType, id, uri, transport, codec); if (channel != null) { if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; } } MessagingChannel channel = defaultChannelBuilder.buildMessagingChannel(channelType, id, uri, transport, codec); if (channel == null) throw new RuntimeException("Could not build channel for type " + channelType + " and uri " + uri); if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; }
@Override public void start() { super.start(); if (sharedContext == null) { extendedCodecs = (extendedCodecs != null ? extendedCodecs : new ArrayList<ExtendedObjectCodec>(Arrays.asList(new ClientEntityCodec()))); defaultStoredStrings = (defaultStoredStrings != null ? defaultStoredStrings : new ArrayList<String>(JMFAMFUtil.AMF_DEFAULT_STORED_STRINGS)); reflection = (reflection != null ? reflection : Platform.reflection()); sharedContext = new DefaultClientSharedContext(new DefaultCodecRegistry(extendedCodecs), defaultStoredStrings, reflection, aliasRegistry); } }
@Override public RemotingChannel newRemotingChannel(String id, ServerApp serverApp, int maxConcurrentRequests) { if (getRemotingTransport() == null) throw new RuntimeException("Remoting transport not defined, start the ChannelFactory first"); if (!getRemotingTransport().isStarted() && !getRemotingTransport().start()) throw new TransportException("Could not start remoting transport: " + getRemotingTransport()); RemotingChannel channel = defaultChannelBuilder.buildRemotingChannel(getRemotingChannelClass(), id, serverApp, maxConcurrentRequests, getRemotingTransport(), newMessagingCodec(AMF0Message.class)); if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; }
@Override public MessagingChannel newMessagingChannel(String channelType, String id, URI uri) { Transport transport = getMessagingTransport(channelType); if (transport == null) throw new RuntimeException("No transport defined for channel type " + channelType + ", start the ChannelFactory first"); if (!transport.isStarted() && !transport.start()) throw new TransportException("Could not start messaging transport: " + transport); MessagingCodec<Message[]> codec = newMessagingCodec(Message[].class); for (ChannelBuilder builder : ServiceLoader.load(ChannelBuilder.class)) { MessagingChannel channel = builder.buildMessagingChannel(channelType, id, uri, transport, codec); if (channel != null) { if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; } } MessagingChannel channel = defaultChannelBuilder.buildMessagingChannel(channelType, id, uri, transport, codec); if (channel == null) throw new RuntimeException("Could not build channel for type " + channelType + " and uri " + uri); if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; }
@Override public void start() { super.start(); if (sharedContext == null) { extendedCodecs = (extendedCodecs != null ? extendedCodecs : new ArrayList<ExtendedObjectCodec>(Arrays.asList(new ClientEntityCodec()))); defaultStoredStrings = (defaultStoredStrings != null ? defaultStoredStrings : new ArrayList<String>(JMFAMFUtil.AMF_DEFAULT_STORED_STRINGS)); reflection = (reflection != null ? reflection : Platform.reflection()); sharedContext = new DefaultClientSharedContext(new DefaultCodecRegistry(extendedCodecs), defaultStoredStrings, reflection, aliasRegistry); } }
@Override public RemotingChannel newRemotingChannel(String id, URI uri, int maxConcurrentRequests) { if (getRemotingTransport() == null) throw new RuntimeException("Remoting transport not defined, start the ChannelFactory first"); if (!getRemotingTransport().isStarted() && !getRemotingTransport().start()) throw new TransportException("Could not start remoting transport: " + getRemotingTransport()); RemotingChannel channel = defaultChannelBuilder.buildRemotingChannel(getRemotingChannelClass(), id, uri, maxConcurrentRequests, getRemotingTransport(), newMessagingCodec(AMF0Message.class)); if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; }
@Override public RemotingChannel newRemotingChannel(String id, String uri) { return newRemotingChannel(id, uri, RemotingChannel.DEFAULT_MAX_CONCURRENT_REQUESTS); }
@Override public MessagingChannel newMessagingChannel(String id, URI uri) { return newMessagingChannel(defaultChannelType, id, uri); }
@Override public MessagingChannel newMessagingChannel(String channelType, String id, ServerApp serverApp) { Transport transport = getMessagingTransport(channelType); if (transport == null) throw new RuntimeException("No transport defined for channel type " + channelType + ", start the ChannelFactory first"); if (!transport.isStarted() && !transport.start()) throw new TransportException("Could not start messaging transport: " + transport); MessagingCodec<Message[]> codec = newMessagingCodec(Message[].class); for (ChannelBuilder builder : ServiceLoader.load(ChannelBuilder.class)) { MessagingChannel channel = builder.buildMessagingChannel(channelType, id, serverApp, transport, codec); if (channel != null) { if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; } } MessagingChannel channel = defaultChannelBuilder.buildMessagingChannel(channelType, id, serverApp, transport, codec); if (channel == null) throw new RuntimeException("Could not build channel for type " + channelType + " and server " + serverApp.getServerName()); if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; }
@Override public void stop(boolean stopTransports) { try { super.stop(stopTransports); } finally { sharedContext = null; extendedCodecs = null; defaultStoredStrings = null; reflection = null; } }
@Override public void start() { super.start(); if (sharedContext == null) { extendedCodecs = (extendedCodecs != null ? extendedCodecs : new ArrayList<ExtendedObjectCodec>(Arrays.asList(new ClientEntityCodec()))); defaultStoredStrings = (defaultStoredStrings != null ? defaultStoredStrings : new ArrayList<String>(JMFAMFUtil.AMF_DEFAULT_STORED_STRINGS)); reflection = (reflection != null ? reflection : Platform.reflection()); sharedContext = new DefaultClientSharedContext(new DefaultCodecRegistry(extendedCodecs), defaultStoredStrings, reflection, aliasRegistry); } }
@Override public RemotingChannel newRemotingChannel(String id, ServerApp serverApp, int maxConcurrentRequests) { if (getRemotingTransport() == null) throw new RuntimeException("Remoting transport not defined, start the ChannelFactory first"); if (!getRemotingTransport().isStarted() && !getRemotingTransport().start()) throw new TransportException("Could not start remoting transport: " + getRemotingTransport()); RemotingChannel channel = defaultChannelBuilder.buildRemotingChannel(getRemotingChannelClass(), id, serverApp, maxConcurrentRequests, getRemotingTransport(), newMessagingCodec(AMF0Message.class)); if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; }
@Override public RemotingChannel newRemotingChannel(String id, String uri) { return newRemotingChannel(id, uri, RemotingChannel.DEFAULT_MAX_CONCURRENT_REQUESTS); }
@Override public MessagingChannel newMessagingChannel(String id, ServerApp serverApp) { return newMessagingChannel(defaultChannelType, id, serverApp); }
@Override public MessagingChannel newMessagingChannel(String channelType, String id, ServerApp serverApp) { Transport transport = getMessagingTransport(channelType); if (transport == null) throw new RuntimeException("No transport defined for channel type " + channelType + ", start the ChannelFactory first"); if (!transport.isStarted() && !transport.start()) throw new TransportException("Could not start messaging transport: " + transport); MessagingCodec<Message[]> codec = newMessagingCodec(Message[].class); for (ChannelBuilder builder : ServiceLoader.load(ChannelBuilder.class)) { MessagingChannel channel = builder.buildMessagingChannel(channelType, id, serverApp, transport, codec); if (channel != null) { if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; } } MessagingChannel channel = defaultChannelBuilder.buildMessagingChannel(channelType, id, serverApp, transport, codec); if (channel == null) throw new RuntimeException("Could not build channel for type " + channelType + " and server " + serverApp.getServerName()); if (defaultTimeToLive != null) channel.setDefaultTimeToLive(defaultTimeToLive); return channel; }
@Override public void stop(boolean stopTransports) { try { super.stop(stopTransports); } finally { sharedContext = null; extendedCodecs = null; defaultStoredStrings = null; reflection = null; } }