FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
HS-algorithm/NodeClient.java at master · magg/HS-algorithm · GitHub
magg
HS-algorithm
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
HS-algorithm
/
NodeClient.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
34 lines (28 loc) · 850 Bytes
Breadcrumbs
HS-algorithm
/
NodeClient.java
Copy path
File metadata and controls
34 lines (28 loc) · 850 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import
Eleccion
.*;
import
org
.
omg
.
CosNaming
.*;
import
org
.
omg
.
CosNaming
.
NamingContextPackage
.*;
import
org
.
omg
.
CORBA
.*;
import
java
.
io
.*;
/**
*
* @author Miguel Alejandro
*/
public
class
NodeClient
{
public
static
void
main
(
String
args
[]) {
try
{
//crea e inicializa el orb
ORB
orb
=
ORB
.
init
(
args
,
null
);
org
.
omg
.
CORBA
.
Object
objRef
=
orb
.
resolve_initial_references
(
"NameService"
);
NamingContextExt
ncRef
=
NamingContextExtHelper
.
narrow
(
objRef
);
NameComponent
nc1
=
new
NameComponent
(
"node0"
,
""
);
NameComponent
path
[] = {
nc1
};
Node
n1
=
NodeHelper
.
narrow
(
ncRef
.
resolve
(
path
));
n1
.
election
();
int
leader
=
n1
.
getLeader
();
System
.
out
.
println
(
"El lider fue: "
+
leader
);
}
catch
(
Exception
e
) {
System
.
out
.
println
(
"ERROR:"
+
e
);
e
.
printStackTrace
(
System
.
out
);
}
}
}
Back
|
FazBrowse Home
|
New Git URL