Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
nfs4j
Commits
c986ce13
Commit
c986ce13
authored
Nov 10, 2010
by
Tatjana Baranova
Committed by
Tigran Mkrtchyan
Nov 10, 2010
Browse files
rpc: add a service name into OncRpcSrv
Signed-off-by: Tatjana Baranova Signed-off-by: Tigran Mkrtchyan
parent
bd7bfe07
Changes
3
Hide whitespace changes
Inline
Side-by-side
oncrpcsvc.xml
View file @
c986ce13
...
...
@@ -148,12 +148,13 @@
</bean>
<!--
ONC RPC service for
M
DS
ONC RPC service for DS
-->
<bean
id=
"oncrpcsvc-ds"
class=
"org.dcache.xdr.OncRpcSvc"
destroy-method=
"stop"
>
<description>
Onc RPC service FOR DS
</description>
<constructor-arg
type=
"int"
value=
"${ds.port}"
/>
<constructor-arg
type=
"boolean"
value=
"false"
/>
<constructor-arg
type=
"String"
value=
"oncrpcsvc-ds"
/>
<property
name=
"programs"
>
<map>
<entry
key-ref=
"nfsv4-programm"
value-ref=
"ds"
/>
...
...
src/org/dcache/xdr/OncRpcSvc.java
View file @
c986ce13
...
...
@@ -44,10 +44,14 @@ public class OncRpcSvc {
private
final
static
Logger
_log
=
Logger
.
getLogger
(
OncRpcSvc
.
class
.
getName
());
/**
* Default name of RPC service.
*/
private
final
static
String
DEFAULT_SERVICE_NAME
=
"ONCRPC Service"
;
private
final
Controller
_controller
=
new
Controller
();
private
final
CountDownLatch
_serverReady
=
new
CountDownLatch
(
1
);
private
final
boolean
_publish
;
/**
* mapping of registered programs.
*/
...
...
@@ -55,12 +59,27 @@ public class OncRpcSvc {
new
ConcurrentHashMap
<
OncRpcProgram
,
RpcDispatchable
>();
/**
* Create a new server. Bind to all supported protocols.
* Name of this service. Used as a thread name.
*/
private
final
String
_name
;
/**
* Create a new server with default name. Bind to all supported protocols.
*
* @param port TCP/UDP port to which service will he bound.
*/
public
OncRpcSvc
(
int
port
)
{
this
(
port
,
IpProtocolType
.
TCP
|
IpProtocolType
.
UDP
,
true
);
this
(
port
,
IpProtocolType
.
TCP
|
IpProtocolType
.
UDP
,
true
,
DEFAULT_SERVICE_NAME
);
}
/**
* Create a new server with given. Bind to all supported protocols.
*
* @param port to bing
* @param name of the service
*/
public
OncRpcSvc
(
int
port
,
String
name
)
{
this
(
port
,
IpProtocolType
.
TCP
|
IpProtocolType
.
UDP
,
true
,
name
);
}
/**
...
...
@@ -69,29 +88,46 @@ public class OncRpcSvc {
* @param port TCP/UDP port to which service will he bound.
* @param publish if true, register service by portmap
*/
public
OncRpcSvc
(
int
port
,
boolean
publish
)
{
this
(
port
,
IpProtocolType
.
TCP
|
IpProtocolType
.
UDP
,
publish
);
public
OncRpcSvc
(
int
port
,
boolean
publish
,
String
nameOfServer
)
{
this
(
port
,
IpProtocolType
.
TCP
|
IpProtocolType
.
UDP
,
publish
,
nameOfServer
);
}
/**
* Create a new server.
*
/**
* Create a new server
with given name, protocol and port number
.
*
* @param port TCP/UDP port to which service will he bound.
* @param protocol to bind (tcp or udp)
* @param name of the service
*/
public
OncRpcSvc
(
int
port
,
int
protocol
,
boolean
publish
,
String
name
)
{
this
(
new
PortRange
(
port
),
protocol
,
publish
,
name
);
}
/**
* Create a new server with @{link PortRange} and name. If <code>publish</code>
* is <code>true</code>, publish this service in a portmap.
*
* @param portRange to use.
* @param publish this service
* @param name of the service
*/
public
OncRpcSvc
(
int
port
,
int
protocol
,
boolean
publish
)
{
this
(
new
P
ortRange
(
port
),
protocol
,
publish
);
public
OncRpcSvc
(
PortRange
portRange
,
boolean
publish
,
String
name
)
{
this
(
p
ortRange
,
IpProtocolType
.
TCP
|
IpProtocolType
.
UDP
,
publish
,
name
);
}
/**
* Create a new server.
* Create a new server with given @{link PortRange} and name. If <code>publish</code>
* is <code>true</code>, publish this service in a portmap.
*
* @param {@link PortRange} of TCP/UDP ports to which service will he bound.
* @param protocol to bind (tcp or udp).
* @param publish this service.
* @param name of the service.
*/
public
OncRpcSvc
(
PortRange
portRange
,
int
protocol
,
boolean
publish
)
{
public
OncRpcSvc
(
PortRange
portRange
,
int
protocol
,
boolean
publish
,
String
name
)
{
_publish
=
publish
;
_name
=
name
;
if
(
(
protocol
&
(
IpProtocolType
.
TCP
|
IpProtocolType
.
UDP
))
==
0
)
{
throw
new
IllegalArgumentException
(
"TCP or UDP protocol have to be defined"
);
...
...
@@ -200,7 +236,7 @@ public class OncRpcSvc {
* Start service.
*/
public
void
start
()
throws
IOException
{
new
Thread
(
_controller
,
"ONCRPC Service"
).
start
();
new
Thread
(
_controller
,
_name
).
start
();
try
{
_serverReady
.
await
();
}
catch
(
InterruptedException
ex
)
{
...
...
src/org/dcache/xdr/portmap/OncRpcEmbeddedPortmap.java
View file @
c986ce13
...
...
@@ -42,7 +42,7 @@ public class OncRpcEmbeddedPortmap {
public
OncRpcEmbeddedPortmap
(
int
timeout
)
throws
UnknownHostException
,
IOException
{
// we start embeded portmap only if there no other one is running
// we start embed
d
ed portmap only if there no other one is running
OncRpcClient
rpcClient
=
null
;
boolean
localPortmapperRunning
=
false
;
...
...
@@ -64,7 +64,8 @@ public class OncRpcEmbeddedPortmap {
}
if
(!
localPortmapperRunning
)
{
OncRpcSvc
rpcbindServer
=
new
OncRpcSvc
(
OncRpcPortmap
.
PORTMAP_PORT
,
IpProtocolType
.
UDP
|
IpProtocolType
.
TCP
,
true
);
OncRpcSvc
rpcbindServer
=
new
OncRpcSvc
(
OncRpcPortmap
.
PORTMAP_PORT
,
IpProtocolType
.
UDP
|
IpProtocolType
.
TCP
,
true
,
"Embedded Portmap"
);
rpcbindServer
.
register
(
new
OncRpcProgram
(
OncRpcPortmap
.
PORTMAP_PROGRAMM
,
OncRpcPortmap
.
PORTMAP_V2
),
new
OncRpcbindServer
());
rpcbindServer
.
start
();
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment