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
9308e6b2
Commit
9308e6b2
authored
Sep 06, 2010
by
Tigran Mkrtchyan
☕
Browse files
rpcsvc: added a method to get socketaddress.
parent
0f8ace98
Changes
2
Hide whitespace changes
Inline
Side-by-side
pom.xml
View file @
9308e6b2
...
...
@@ -260,6 +260,12 @@
<url>
http://download.java.net/maven/glassfish/
</url>
<layout>
default
</layout>
</repository>
<repository>
<id>
download.java.net
</id>
<name>
Glassfish Repository for Maven
</name>
<url>
http://download.java.net/maven/glassfish/
</url>
<layout>
default
</layout>
</repository>
<repository>
<id>
maven2-repository.dev.java.net
</id>
<name>
Java.net Repository for Maven
</name>
...
...
src/org/dcache/xdr/OncRpcSvc.java
View file @
9308e6b2
...
...
@@ -29,6 +29,7 @@ import com.sun.grizzly.TCPSelectorHandler;
import
com.sun.grizzly.UDPSelectorHandler
;
import
java.io.IOException
;
import
java.net.InetAddress
;
import
java.net.InetSocketAddress
;
import
java.net.UnknownHostException
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
...
...
@@ -268,4 +269,33 @@ public class OncRpcSvc {
public
void
setThreadCount
(
int
count
)
{
_controller
.
setReadThreadsCount
(
count
);
}
/**
* Returns the address of the endpoint this service is bound to,
* or <code>null<code> if it is not bound yet.
* @param protocol
* @return a {@link InetSocketAddress} representing the local endpoint of
* this service, or <code>null</code> if it is not bound yet.
*/
public
InetSocketAddress
getInetSocketAddress
(
int
protocol
)
{
TCPSelectorHandler
handler
;
switch
(
protocol
){
case
IpProtocolType
.
TCP
:
handler
=
(
TCPSelectorHandler
)
_controller
.
getSelectorHandler
(
Controller
.
Protocol
.
TCP
);
break
;
case
IpProtocolType
.
UDP
:
handler
=
(
UDPSelectorHandler
)
_controller
.
getSelectorHandler
(
Controller
.
Protocol
.
UDP
);
break
;
default
:
handler
=
null
;
}
if
(
handler
!=
null
)
{
return
new
InetSocketAddress
(
handler
.
getInet
(),
handler
.
getPort
());
}
return
null
;
}
}
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