Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ipc
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Scott Snyder
ipc
Commits
441cdea4
Commit
441cdea4
authored
3 years ago
by
Serguei Kolos
Browse files
Options
Downloads
Patches
Plain Diff
Remove unnecessary synchronisation
parent
a21f33b7
No related branches found
Branches containing commit
Tags
v0.03.00
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
jsrc/ipc/ClientInterceptor.java
+26
-34
26 additions, 34 deletions
jsrc/ipc/ClientInterceptor.java
jtest/Test.java
+40
-1
40 additions, 1 deletion
jtest/Test.java
with
66 additions
and
35 deletions
jsrc/ipc/ClientInterceptor.java
+
26
−
34
View file @
441cdea4
...
...
@@ -102,46 +102,38 @@ class ClientInterceptor extends org.omg.CORBA.LocalObject implements
ers
.
Logger
.
debug
(
1
,
threadName
+
": ["
+
exception
+
"] exception received"
);
org
.
omg
.
CORBA
.
Object
object
=
ri
.
target
();
ers
.
Logger
.
debug
(
1
,
threadName
+
": target = "
+
Core
.
objectToString
(
object
,
Core
.
CORBALOC
));
String
currentTarget
=
Core
.
objectToString
(
object
,
Core
.
IOR
);
ers
.
Logger
.
debug
(
1
,
threadName
+
": target = "
+
currentTarget
);
Any
any
;
String
originalTarget
;
org
.
omg
.
CORBA
.
Object
new_object
;
try
{
any
=
ri
.
get_slot
(
this
.
slot
);
}
catch
(
InvalidSlot
ex
)
{
Any
any
=
ri
.
get_slot
(
this
.
slot
);
originalTarget
=
any
.
extract_string
();
ers
.
Logger
.
debug
(
1
,
threadName
+
": original target = "
+
originalTarget
);
new_object
=
Cache
.
recover
(
object
);
}
catch
(
Exception
ex
)
{
ers
.
Logger
.
debug
(
1
,
ex
);
return
;
return
;
}
String
originalTarget
=
""
;
if
(
any
.
type
().
kind
().
equals
(
TCKind
.
tk_string
))
{
originalTarget
=
any
.
extract_string
();
String
newTarget
=
Core
.
objectToString
(
new_object
,
Core
.
IOR
);
ers
.
Logger
.
debug
(
1
,
threadName
+
": new target = "
+
newTarget
);
if
(
originalTarget
.
equals
(
newTarget
))
{
ers
.
Logger
.
debug
(
1
,
threadName
+
": The last known object reference is the same as the failed one,"
+
" no further recovery attempts will be made."
);
return
;
}
synchronized
(
object
)
{
org
.
omg
.
CORBA
.
Object
new_object
;
try
{
new_object
=
Cache
.
recover
(
object
);
}
catch
(
Exception
ex
)
{
ers
.
Logger
.
debug
(
1
,
ex
);
return
;
}
String
newTarget
=
Core
.
objectToString
(
new_object
,
Core
.
IOR
);
if
(
originalTarget
.
equals
(
newTarget
))
{
ers
.
Logger
.
debug
(
1
,
threadName
+
": The last known object reference is the same as the failed one,"
+
" no further recovery attempts will be made."
);
return
;
}
String
currentTarget
=
Core
.
objectToString
(
object
,
Core
.
IOR
);
if
(
newTarget
.
equals
(
currentTarget
))
{
ers
.
Logger
.
debug
(
1
,
threadName
+
": Recovery had been done in another thread, invoke the same request once more."
);
throw
new
ForwardRequest
();
}
else
{
ers
.
Logger
.
debug
(
1
,
threadName
+
": Invoke the same request with the new object reference."
);
throw
new
ForwardRequest
(
new_object
);
}
if
(
newTarget
.
equals
(
currentTarget
))
{
ers
.
Logger
.
debug
(
1
,
threadName
+
": Recovery had been done in another thread, invoke the same request once more."
);
throw
new
ForwardRequest
();
}
else
{
ers
.
Logger
.
debug
(
1
,
threadName
+
": Invoke the same request with the new object reference."
);
throw
new
ForwardRequest
(
new_object
);
}
}
}
This diff is collapsed.
Click to expand it.
jtest/Test.java
+
40
−
1
View file @
441cdea4
...
...
@@ -169,10 +169,49 @@ public class Test
test_typed_iterators
();
}
static
class
TestThread
extends
Thread
{
private
String
name
;
private
int
timeout
;
TestThread
(
String
name
,
int
timeout
)
{
this
.
name
=
name
;
this
.
timeout
=
timeout
;
}
public
void
run
(){
Partition
p
=
new
Partition
();
try
{
ipc
.
server
tt
=
p
.
lookup
(
ipc
.
server
.
class
,
name
);
System
.
out
.
println
(
"got CORBA object "
+
tt
.
hashCode
());
Thread
.
sleep
(
timeout
);
System
.
out
.
println
(
"invoking ping on CORBA object "
+
tt
.
hashCode
());
tt
.
ping_s
(
"Test string"
);
System
.
out
.
println
(
"ping_s was called successfully"
);
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"System exception : "
+
e
);
}
}
}
public
static
void
test_cache
(
String
name
)
throws
InvalidPartitionException
,
InterruptedException
{
TestThread
t1
=
new
TestThread
(
name
,
5000
);
TestThread
t2
=
new
TestThread
(
name
,
6000
);
t1
.
start
();
t2
.
start
();
t1
.
join
();
t2
.
join
();
}
public
static
void
main
(
String
args
[])
{
try
{
test_cache
(
args
[
0
]);
test_generic_iterators
();
test_lookup
(
args
[
0
]);
...
...
@@ -183,7 +222,7 @@ public class Test
ipc
.
Core
.
constructReference
(
"initial"
,
"ipc/partition"
,
"initial"
,
"pcatd88.cern.ch"
,
12345
));
}
catch
(
InvalidPartition
Exception
ex
)
{
catch
(
Exception
ex
)
{
System
.
err
.
println
(
ex
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment