code: public static long timeUnitToMillis(long value,
                                          TimeUnit unit,
                                          boolean annotation,
                                          BeanMetaData bmd) throws EJBConfigurationException {
  
          final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
          if (isTraceOn && tc.isEntryEnabled()) {
              Tr.entry(tc, "timeUnitToMillis: " + value + unit);
          }
  
          // Initialize to input value in case current unit is already in
          // javax.util.concurrent.TimeUnit.MILLISECONDS
          long timeout = value;
  
          if (timeout > 0) {
  
              timeout = TimeUnit.MILLISECONDS.convert(value, unit);
              if (timeout == Long.MAX_VALUE || timeout == Long.MIN_VALUE) {
                  Tr.error(tc, "STATEFUL_TIMEOUT_OVERFLOW_CNTR0309E",
                           new Object[] { bmd.getName(), bmd.getModuleMetaData().getName(),
                                         bmd.getModuleMetaData().getApplicationMetaData().getName(),
                                         value, unit });
                  throw new EJBConfigurationException("Conversion of stateful session timeout value of " +
                                                      value + " " + unit + " to milliseconds resulted in overflow.");
              }
  
          }
          else {
              if (timeout == 0) {
                  // 0 means no wait, represented internally as the nominal 1 millisecond
                  timeout = 1;
              }
              else if (timeout == -1) {
                  // -1 indicates wait forever, represented internally as 0
                  timeout = 0L;
              }
              else {
  
                  // invalid (negative) timeout value
                  Object[] parms = new Object[] { bmd.getName(), bmd.getModuleMetaData().getName(), bmd.getModuleMetaData().getApplicationMetaData().getName(), timeout };
                  if (annotation) {
                      Tr.error(tc, "NEGATIVE_STATEFUL_TIMEOUT_ANN_CNTR0311E", parms);
                  }
                  else {
                      Tr.error(tc, "NEGATIVE_STATEFUL_TIMEOUT_XML_CNTR0312E", parms);
                  }
  
                  throw new EJBConfigurationException("Stateful session timeout value of " +
                                                      value + " " + unit + " is negative.");
  
              }
          }
  
          if (isTraceOn && tc.isEntryEnabled()) {
              Tr.exit(tc, "timeUnitToMillis: " + timeout);
          }
  
          return timeout;
      }
docs: F743-6605.1 streamlined method.