/** * @see gov.aps.jca.Channel#addConnectionListener(gov.aps.jca.event.ConnectionListener) */ public synchronized void addConnectionListenerAndFireIfConnected(ConnectionListener l) throws CAException, IllegalStateException { checkNotClosedState(); if (l == null) throw new IllegalArgumentException("l == null"); if (connectionState == ConnectionState.CONNECTED) context.getEventDispatcher().dispatch(new ConnectionEvent(this, true), l); addConnectionListener(l); }
if (addListener) { try { Channel channel = (Channel) ev.getSource(); channel.addAccessRightsListener(new AccessRightsListener() {
public void connectionChanged(ConnectionEvent event) { if (event.isConnected()) initializeMonitor(); }
Channel channel = (Channel) ev.getSource(); if (ev.isConnected() && channel.getElementCount() >= LARGE_ARRAY && !largeArray) { disconnect(); largeArray = true; if (ev.isConnected()) { if (addListener) { try { Channel channel = (Channel) ev.getSource(); channel.addAccessRightsListener(new AccessRightsListener() {
/** * Set connection state and if changed, notifies listeners. * @param newState state to set. */ private synchronized void setConnectionState(ConnectionState connectionState) { if (this.connectionState != connectionState) { this.connectionState = connectionState; boolean connectionStatusToReport = (connectionState == ConnectionState.CONNECTED); if (connectionStatusToReport != lastReportedConnectionState) { lastReportedConnectionState = connectionStatusToReport; synchronized (connectionListeners) { context.getEventDispatcher().dispatch( new ConnectionEvent(this, connectionStatusToReport), connectionListeners ); } } } }
public void connectionChanged(ConnectionEvent event) { if(!event.isConnected()) { putDone(disconnectedWhileActiveStatus); getDone(disconnectedWhileActiveStatus); } else { initializePut(); } }
/** * Set connection state and if changed, notifies listeners. * @param newState state to set. */ private synchronized void setConnectionState(ConnectionState connectionState) { if (this.connectionState != connectionState) { this.connectionState = connectionState; boolean connectionStatusToReport = (connectionState == ConnectionState.CONNECTED); if (connectionStatusToReport != lastReportedConnectionState) { lastReportedConnectionState = connectionStatusToReport; synchronized (connectionListeners) { context.getEventDispatcher().dispatch( new ConnectionEvent(this, connectionStatusToReport), connectionListeners ); } } } }
public void connectionChanged(ConnectionEvent arg0) { boolean isConnected = arg0.isConnected(); if(isConnected) { if(gotFirstConnection.getAndSet(true)) { channelRequester.channelStateChange(this, ConnectionState.CONNECTED); return; } else { if(channelFindRequester!=null) { channelFindRequester.channelFindResult(okStatus, this, true); destroy(); return; } channelRequester.channelCreated(okStatus, this); channelRequester.channelStateChange(this, ConnectionState.CONNECTED); } } else { channelRequester.channelStateChange(this, ConnectionState.DISCONNECTED); } } }
/** * @see gov.aps.jca.Channel#addConnectionListener(gov.aps.jca.event.ConnectionListener) */ public synchronized void addConnectionListenerAndFireIfConnected(ConnectionListener l) throws CAException, IllegalStateException { checkNotClosedState(); if (l == null) throw new IllegalArgumentException("l == null"); if (connectionState == ConnectionState.CONNECTED) context.getEventDispatcher().dispatch(new ConnectionEvent(this, true), l); addConnectionListener(l); }
public void connectionChanged(ConnectionEvent event) { if(!event.isConnected()) { getDone(disconnectedWhileActiveStatus); } else { if(v3ChannelStructure.createPVStructure(pvRequest,true)==null) { channelGetRequester.channelGetConnect(createChannelStructureStatus,this,null); destroy(); } else { channelGetRequester.channelGetConnect(okStatus, this, v3ChannelStructure.getPVStructure().getStructure()); } } }
/** * Constructor. * @param channelGetRequester The channelGetRequester. * @param v3Channel The V3Channel * @param pvRequest The request structure. */ public BaseV3ChannelGet(ChannelGetRequester channelGetRequester, V3Channel v3Channel,PVStructure pvRequest) { this.channelGetRequester = channelGetRequester; this.v3Channel = v3Channel; this.pvRequest = pvRequest; v3Channel.add(this); v3ChannelStructure = new BaseV3ChannelStructure(v3Channel); this.jcaChannel = v3Channel.getJCAChannel(); try { jcaChannel.addConnectionListener(this); } catch (Throwable th) { channelGetRequester.channelGetConnect(statusCreate.createStatus(StatusType.ERROR, "addConnectionListener failed", th), this, null); destroy(); return; } // there is a possible run condition, but it's OK if (jcaChannel.getConnectionState() == Channel.CONNECTED) connectionChanged(new ConnectionEvent(jcaChannel, true)); } /* (non-Javadoc)
/** * Constructor. * @param monitorRequester The monitorRequester. * @param v3Channel The V3Channel * @param pvRequest The request structure. */ public BaseV3Monitor(MonitorRequester monitorRequester,V3Channel v3Channel,PVStructure pvRequest) { this.monitorRequester = monitorRequester; this.v3Channel = v3Channel; this.pvRequest = pvRequest; v3Channel.add(this); v3ChannelStructure = new BaseV3ChannelStructure(v3Channel); jcaChannel = v3Channel.getJCAChannel(); try { jcaChannel.addConnectionListener(this); } catch (CAException e) { overrunBitSet = null; monitorElement = null; monitorRequester.monitorConnect(statusCreate.createStatus(StatusType.ERROR, "addConnectionListener failed", e), null,null); destroy(); return; }; // there is a possible run condition, but it's OK if (jcaChannel.getConnectionState() == Channel.CONNECTED) connectionChanged(new ConnectionEvent(jcaChannel, true)); }
/** * Constructor. * @param channelPutRequester The channelPutRequester. * @param v3Channel The V3Channel * @param pvRequest The request structure. */ public BaseV3ChannelPut(ChannelPutRequester channelPutRequester, V3Channel v3Channel,PVStructure pvRequest) { this.channelPutRequester = channelPutRequester; this.v3Channel = v3Channel; this.pvRequest = pvRequest; v3Channel.add(this); v3ChannelStructure = new BaseV3ChannelStructure(v3Channel); this.jcaChannel = v3Channel.getJCAChannel(); try { jcaChannel.addConnectionListener(this); } catch (Throwable th) { elementCount = 1; channelPutRequester.channelPutConnect(statusCreate.createStatus(StatusType.ERROR, "addConnectionListener failed", th),this,null); destroy(); return; } // there is a possible run condition, but it's OK if (jcaChannel.getConnectionState() == Channel.CONNECTED) connectionChanged(new ConnectionEvent(jcaChannel, true)); }