{
if (name == null) {
throw new NullPointerException("null name");
}
this.name = name;
DataService dataService = getDataService();
if (listener != null) {
if (!(listener instanceof Serializable)) {
throw new IllegalArgumentException("non-serializable listener");
} else if (!(listener instanceof ManagedObject)) {
listener = new ManagedSerializableChannelListener(listener);
}
this.listenerRef = dataService.createReference(listener);
} else {
this.listenerRef = null;
}
this.delivery = delivery;
this.writeBufferCapacity = writeBufferCapacity;
this.txn = ChannelServiceImpl.getTransaction();
ManagedReference<ChannelImpl> ref = dataService.createReference(this);
if (channelWrapper == null) {
channelWrapper = new ChannelWrapper(ref);
} else {
channelWrapper.setChannelRef(ref);
}
this.wrappedChannelRef = dataService.createReference(channelWrapper);
this.channelRefId = ref.getId();
this.coordNodeId = getLocalNodeId();
if (logger.isLoggable(Level.FINER)) {
logger.log(Level.FINER, "Created ChannelImpl:{0}", channelRefId);
}
getChannelsMap().putOverride(name, this);
EventQueue eventQueue = new EventQueue(this);
eventQueueRef = dataService.createReference(eventQueue);
getEventQueuesMap(coordNodeId).
put(channelRefId.toString(), eventQueue);
}