MCPcopy Create free account
hub / github.com/OpenTSDB/asynchbase / handleDisconnect

Method handleDisconnect

src/HBaseClient.java:3860–3907  ·  view source on GitHub ↗
(final ChannelStateEvent state_event)

Source from the content-addressed store, hash-verified

3858 }
3859
3860 private void handleDisconnect(final ChannelStateEvent state_event) {
3861 if (disconnected) {
3862 return;
3863 }
3864 if (LOG.isDebugEnabled()) {
3865 LOG.debug("Channel " + state_event.getChannel().toString() +
3866 "'s state changed: " + state_event);
3867 }
3868 switch (state_event.getState()) {
3869 case OPEN:
3870 if (state_event.getValue() == Boolean.FALSE) {
3871 break; // CLOSED
3872 }
3873 return;
3874 case CONNECTED:
3875 if (state_event.getValue() == null) {
3876 break; // DISCONNECTED
3877 }
3878 return;
3879 default:
3880 return; // Not an event we're interested in, ignore it.
3881 }
3882
3883 LOG.info("Channel " + state_event.getChannel().toString() +
3884 " is disconnecting: " + state_event);
3885 disconnected = true; // So we don't clean up the same client twice.
3886 try {
3887 final RegionClient client = super.get(RegionClient.class);
3888 SocketAddress remote = super.getChannel().getRemoteAddress();
3889 // At this point Netty gives us no easy way to access the
3890 // SocketAddress of the peer we tried to connect to, so we need to
3891 // find which entry in the map was used for the rootregion. This
3892 // kinda sucks but I couldn't find an easier way.
3893 if (remote == null) {
3894 remote = slowSearchClientIP(client);
3895 }
3896
3897 // Prevent the client from buffering requests while we invalidate
3898 // everything we have about it.
3899 synchronized (client) {
3900 removeClientFromCache(client, remote);
3901 }
3902 } catch (Exception e) {
3903 LoggerFactory.getLogger(RegionClientPipeline.class)
3904 .error("Uncaught exception when handling a disconnection of "
3905 + getChannel(), e);
3906 }
3907 }
3908
3909 }
3910

Callers 2

sendDownstreamMethod · 0.95
sendUpstreamMethod · 0.95

Calls 6

getChannelMethod · 0.80
getRemoteAddressMethod · 0.80
slowSearchClientIPMethod · 0.80
removeClientFromCacheMethod · 0.80
toStringMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected