GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — add delay to ExampleHelloRPC; test request timeout in HelloWorldRPC · epics-base/exampleJava@d9938a9

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • database/src/org/epics/exampleJava/exampleDatabase
    • ExampleHelloRPC.java
  • exampleClient/src/org/epics/exampleClient
    • HelloWorldRPC.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎database/src/org/epics/exampleJava/exampleDatabase/ExampleHelloRPC.java‎

Copy file name to clipboardExpand all lines: database/src/org/epics/exampleJava/exampleDatabase/ExampleHelloRPC.java
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ public void put(PVString pvFrom)
7979
PVString pvTo = pvResult.getSubField(PVString.class,"value");
8080
pvTo.put("Hello " + pvFrom.get());
8181
process();
82+
try {
83+
Thread.sleep(1000);
84+
} catch (Exception e) {
85+
System.err.println("Unexpected exception " + e.getMessage());
86+
}
8287
endGroupPut();
8388
unlock();
8489
}
Collapse file

‎exampleClient/src/org/epics/exampleClient/HelloWorldRPC.java‎

Copy file name to clipboardExpand all lines: exampleClient/src/org/epics/exampleClient/HelloWorldRPC.java
+39-18Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,29 @@ public void requestDone(
3636
Status status,
3737
PvaClientRPC pvaClientRPC,
3838
PVStructure pvResponse)
39-
{
40-
System.out.println("response\n" + pvResponse.toString());
41-
requestDoneCalled = true;
42-
}
43-
public void waitResponse()
44-
{
45-
while(true)
46-
{
47-
if(requestDoneCalled) {
48-
requestDoneCalled = false;
49-
return;
50-
}
51-
try {
39+
{
40+
if(status.isOK()) {
41+
System.out.println("response\n" + pvResponse.toString());
42+
requestDoneCalled = true;
43+
} else {
44+
System.out.println("response error\n" + status.getMessage());
45+
}
46+
}
47+
public void waitResponse()
48+
{
49+
while(true)
50+
{
51+
if(requestDoneCalled) {
52+
requestDoneCalled = false;
53+
return;
54+
}
55+
try {
5256
Thread.sleep(100);
53-
} catch (InterruptedException e) {
54-
System.err.println("exception " + e.getMessage());
55-
}
56-
}
57-
}
57+
} catch (InterruptedException e) {
58+
System.err.println("exception " + e.getMessage());
59+
}
60+
}
61+
}
5862
}
5963

6064
static final FieldCreate fieldCreate = FieldFactory.getFieldCreate();
@@ -118,6 +122,23 @@ static void exampleEvenMore(PvaClient pva,String channelName)
118122
System.out.println("send " + pvArgument.get());
119123
rpc.request(pvRequest, requester);
120124
requester.waitResponse();
125+
rpc.setResponseTimeout(.001);
126+
pvArgument.put("Once again");
127+
System.out.println("send " + pvArgument.get());
128+
try {
129+
rpc.request(pvRequest, requester);
130+
requester.waitResponse();
131+
} catch (Exception e)
132+
{
133+
System.err.println("Expected exception " + e.getMessage());
134+
}
135+
try {
136+
rpc.request(pvRequest, requester);
137+
rpc.request(pvRequest, requester);
138+
} catch (Exception e)
139+
{
140+
System.err.println("Expected exception " + e.getMessage());
141+
}
121142
}
122143

123144
public static void main( String[] args )

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.