czwartek, 12 lipca 2012

Integration with Ice4j

  Last time I worked on integrating pseudotcp code with ice4. It was quite simple as all I had to do was change package names and include my unit tests in the ice4j's test suite. The last one required to switch to older version of JUnit. It doesn't support annotations so I had to derive my base test class from the TestCase and rename all test methods to start with lower case "test" keyword.
  Next task was to create an example how pseudotcp may be used with Ice4j library. The basic scenario is that there are two ice clients establishing UDP connectivity. Then selected addresses are used for pseudotcp transfer. Optionally STUN and TURN harvesters may be used - by default it works only with local interfaces.
  Later I've finally switched to java.util.logging.Logger as a logging mechanism. The message templates helped me to resolve the issue with many string concatenations for messges that are not valid for current logging level. Profiler showed that it had visible impact on performance, as there are many messages generated while the protocol is working. Here's an example:

           "--> <CONV={0}><FLG={1}><SEQ={2}:{3}><ACK={4}><WND={5}><TS={7}><TSR={8}><LEN={9}>",
           new Object[]{

The main advantage of this approach is that the string will be generated only if message will be displayed(logging level will be set at least to FINE).

Brak komentarzy:

Publikowanie komentarza