FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaExercises/Head First Java/ServiceServerImpl.java at master · biblelamp/JavaExercises · GitHub
biblelamp
/
JavaExercises
Public
Notifications
You must be signed in to change notification settings
Fork
130
Star
153
Code
Issues
1
Pull requests
9
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaExercises
/
Head First Java
/
ServiceServerImpl.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
37 lines (30 loc) · 1.11 KB
Breadcrumbs
JavaExercises
/
Head First Java
/
ServiceServerImpl.java
Copy path
File metadata and controls
37 lines (30 loc) · 1.11 KB
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
35
36
37
import
java
.
rmi
.*;
import
java
.
util
.*;
import
java
.
rmi
.
server
.*;
public
class
ServiceServerImpl
extends
UnicastRemoteObject
implements
ServiceServer
{
HashMap
<
String
,
Service
>
serviceList
;
public
ServiceServerImpl
()
throws
RemoteException
{
// start and set up services
setUpServices
();
}
private
void
setUpServices
() {
serviceList
=
new
HashMap
<
String
,
Service
>();
serviceList
.
put
(
"Dice Rolling Service"
,
new
DiceService
());
//serviceList.put("Day of the Week Service", new DayOfTheWeekService());
//serviceList.put("Visual Music Service", new MiniMusicService());
}
public
Object
[]
getServiceList
() {
System
.
out
.
println
(
"in remote"
);
return
serviceList
.
keySet
().
toArray
();
}
public
Service
getService
(
Object
serviceKey
)
throws
RemoteException
{
Service
theService
= (
Service
)
serviceList
.
get
(
serviceKey
);
return
theService
;
}
public
static
void
main
(
String
[]
args
) {
try
{
Naming
.
rebind
(
"ServiceServer"
,
new
ServiceServerImpl
());
}
catch
(
Exception
ex
) { }
System
.
out
.
println
(
"Remote service is running"
);
}
}
Back
|
FazBrowse Home
|
New Git URL