code: public synchronized void obtainServerLock() {
  
          getServerLock();
  
          // if the lock is null or is invalid, the server process is already running
          if (serverLock == null || !serverLock.isValid()) {
              serverLock = null;
              lockFileChannel = null;
  
              String lockFilePath = lockFile.getAbsolutePath();
              LaunchException le = new LaunchException("Server(" + serverName + ") is already running.  lockFile="
                                                       + lockFilePath, MessageFormat.format(BootstrapConstants.messages.getString("error.serverAlreadyRunning"),
                                                                                            serverName, lockFilePath));
              le.setReturnCode(ReturnCode.REDUNDANT_ACTION_STATUS);
              throw le;
          }
      }
docs: Obtain the lock that will prevent other servers from starting using this
  directory/workarea.
  <P>
  This handles a single server running per JVM. Trying to run multiple servers
  or multiple instances of a same server within same JVM is not supported.
  
  @throws LaunchException
  exception thrown if there's a problem getting the lock or
  another instance of this server is running