payload = null;
   public byte[] getPayloadAsByteArray()   {                  if (payloadAsByteArray == null && payload != null)      {         try         {            //Convert the payload into a byte array and store internally            final int BUFFER_SIZE = 4096;            JBossObjectOutputStream oos = null;            try            {               ByteArrayOutputStream bos = new ByteArrayOutputStream(BUFFER_SIZE);               oos = new JBossObjectOutputStream(bos);               writePayloadExternal(oos, payload);               payloadAsByteArray = bos.toByteArray();            }            finally            {               if (oos != null)               {                  oos.close();               }            }                }         catch (IOException e)         {            //Should never happen            throw new RuntimeException("Failed to convert payload to byte[]", e);         }      }      return payloadAsByteArray;   }