Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-28064

[GSS](7.4.z) REM3-419 - IntIndexHashMap tuning

XMLWordPrintable

      The Remoting class IntIndexHashMap is used in RemoteConnectionChannel to store the outbound messages leaving the channel endpoint and the inbound messages arriving at the channel endpoint.

          private final IntIndexMap<OutboundMessage> outboundMessages = new IntIndexHashMap<OutboundMessage>(OutboundMessage.INDEXER, Equaller.IDENTITY, 512, 0.5f);
          private final IntIndexMap<InboundMessage> inboundMessages = new IntIndexHashMap<InboundMessage>(InboundMessage.INDEXER, Equaller.IDENTITY, 512, 0.5f);
      

      For example, when an EJBClientChannel instance wants to send an invocation to an EJBServerChannel instance, it will call RemoteConnectionChannel.writeMessage() to create an OutboundMessage instance and write that instance into the outboundMessages map:

          public MessageOutputStream writeMessage() throws IOException {
              int tries = 50;
              IntIndexMap<OutboundMessage> outboundMessages = this.outboundMessages;
              openOutboundMessage();
              boolean ok = false;
              try {
                  final Random random = ThreadLocalRandom.current();
                  while (tries > 0) {
                      final int id = random.nextInt() & 0xfffe;
                      if (! outboundMessages.containsKey(id)) {
                          OutboundMessage message = new OutboundMessage((short) id, this, outboundWindow, maxOutboundMessageSize, messageAckTimeout);
                          OutboundMessage existing = outboundMessages.putIfAbsent(message);
                          if (existing == null) {
                              ok = true;
                              return message;
                          }
                      }
                      tries --;
                  }
                  throw log.channelBusy();
              } finally {
                  if (! ok) {
                      closeOutboundMessage();
                  }
              }
          }
      

      We are finding that, under certain circumstances, the limit of 50 on the attempts to write a OutboundMessage into the map are failing, resulting a ChannelBusyException, and so failed invocations of the EJB client.

      So the question arises: when using an IntIndexHashMap, how can it be tuned to avoid such errors?

              jboss-set_jira JBoss SET
              rachmato@redhat.com Richard Achmatowicz
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: