Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/org/epics/pvaClient/PvaClientChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import org.epics.pvaccess.client.Channel;
import org.epics.pvaccess.client.Channel.ConnectionState;
import org.epics.pvaccess.server.rpc.RPCRequestException;
import org.epics.pvaccess.client.ChannelProvider;
import org.epics.pvaccess.client.ChannelProviderRegistryFactory;
import org.epics.pvaccess.client.ChannelRequester;
Expand Down Expand Up @@ -262,7 +263,8 @@ public void destroy()
isDestroyed = true;
}
if(channel!=null) {
channel.destroy();
System.out.println("skip calling destroy");
// channel.destroy();
channel=null;
}
if(PvaClient.getDebug()) showCache();
Expand Down Expand Up @@ -789,6 +791,7 @@ public PvaClientMonitor createMonitor(PVStructure pvRequest)
public PVStructure rpc(
PVStructure pvRequest,
PVStructure pvArgument)
throws RPCRequestException
{
PvaClientRPC rpc = createRPC(pvRequest);
return rpc.request(pvArgument);
Expand All @@ -799,6 +802,7 @@ public PVStructure rpc(
*/
public PVStructure rpc(
PVStructure pvArgument)
throws RPCRequestException
{
PvaClientRPC rpc = createRPC();
return rpc.request(pvArgument);
Expand Down
18 changes: 16 additions & 2 deletions src/org/epics/pvaClient/PvaClientRPC.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.epics.pvaccess.client.Channel;
import org.epics.pvaccess.client.ChannelRPC;
import org.epics.pvaccess.client.ChannelRPCRequester;
import org.epics.pvaccess.server.rpc.RPCRequestException;
import org.epics.pvdata.factory.StatusFactory;
import org.epics.pvdata.pv.MessageType;
import org.epics.pvdata.pv.PVStructure;
Expand Down Expand Up @@ -83,6 +84,7 @@ private enum RPCConnectState {connectIdle,connectActive,connected};

private volatile boolean isDestroyed = false;
private volatile ChannelRPC channelRPC = null;
private Status status = null;
private PVStructure pvResponse = null;

private enum RPCState {rpcIdle,rpcActive,rpcComplete};
Expand Down Expand Up @@ -165,7 +167,10 @@ public void requestDone(
rpcState = RPCState.rpcIdle;
} else {
rpcState = RPCState.rpcComplete;
if(pvaClientRPCRequester==null) this.pvResponse = pvResponse;
if(pvaClientRPCRequester==null) {
this.status = status;
this.pvResponse = pvResponse;
}
waitForDone.signal();
}
} finally {
Expand Down Expand Up @@ -277,6 +282,7 @@ public Status waitConnect()
* @return The result.
*/
public PVStructure request(PVStructure pvArgument)
throws RPCRequestException
{
checkRPCState();
if(rpcState!=RPCState.rpcIdle) {
Expand Down Expand Up @@ -315,7 +321,14 @@ public PVStructure request(PVStructure pvArgument)
}
}
rpcState = RPCState.rpcIdle;
return pvResponse;
if (status.isSuccess()) {
return pvResponse;
} else {
if (status.getStackDump() == null)
throw new RPCRequestException(status.getType(), status.getMessage());
else
throw new RPCRequestException(status.getType(), status.getMessage() + ", cause:\n" + status.getStackDump());
}
} finally {
lock.unlock();
}
Expand All @@ -332,6 +345,7 @@ public PVStructure request(PVStructure pvArgument)
public void request(
PVStructure pvArgument,
PvaClientRPCRequester pvaClientRPCRequester)
throws RPCRequestException
{
this.pvaClientRPCRequester = pvaClientRPCRequester;
checkRPCState();
Expand Down