open should be called only once - we use FaultTolerantObject for that
433049
public void open(final OperationResult<Void, Exception> onOpen, final OperationResult<Void, Exception> onClose) {

        this.onOpen = onOpen;
        this.onClose = onClose;
        this.sendLink.open();
        this.receiveLink.open();
    }
1132747
private void checkFileReopening(FileObject fileObject, boolean addToHistory) throws FilerException {
        for(FileObject veteran : fileObjectHistory) {
            if (fileManager.isSameFile(veteran, fileObject)) {
                if (lint)
                    log.warning("proc.file.reopening", fileObject.getName());
                throw new FilerException("Attempt to reopen a file for path " + fileObject.getName());
            }
        }
        if (addToHistory)
            fileObjectHistory.add(fileObject);
    }
828431
def once(ctx, name):
    """"""
    from kibitzr.app import Application
    app = Application()
    sys.exit(app.run(once=True, log_level=ctx.obj['log_level'], names=name))
628405
private static void initExceptionThreadPool() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "initExceptionThreadPool");

        // Do a synchronous check to ensure once-only creation
        synchronized (exceptionTPCreateSync) {
            if (exceptionThreadPool == null) {
                // Get the maximum size for the thread pool, defaulting if
                // not specified or if the value cannot be parsed
                int maxThreads = Integer.parseInt(ApiJmsConstants.EXCEPTION_MAXTHREADS_DEFAULT_INT);
                String maxThreadsStr = RuntimeInfo.getProperty(ApiJmsConstants.EXCEPTION_MAXTHREADS_NAME_INT,
                                                               ApiJmsConstants.EXCEPTION_MAXTHREADS_DEFAULT_INT);
                try {
                    maxThreads = Integer.parseInt(maxThreadsStr);
                } catch (NumberFormatException e) {
                    // No FFDC code needed, but we will exception this
                    SibTr.exception(tc, e);
                }

                // Trace the value we will use
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(tc, ApiJmsConstants.EXCEPTION_MAXTHREADS_NAME_INT + ": " + Integer.toString(maxThreads));

                // Create the thread pool
                exceptionThreadPool = new ThreadPool(ApiJmsConstants.EXCEPTION_THREADPOOL_NAME_INT, 0, maxThreads);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "initExceptionThreadPool");
    }
904994
function init(copyObject, cb) {
		var result = 0
		isError = false
		var cbCounter = 1
		for (var to in copyObject) {
			var o = copyObjects[copyObjectsIndex++] =
				new copyobject.CopyObject(copyObject[to], to, notifyFn)
			cbCounter++
			o.doCopy(copyResult)
		}
		copyResult()

		function copyResult(err, count) {
			if (!err) {
				if (count) result += count
				if (!--cbCounter && cb) cb(null, result)
			} else if (!isError) {
				isError = true
				if (cb) cb(err)
			}
		}
	}
1226313
@Override
	public void open() throws IOException, MemoryAllocationException, InterruptedException {
		this.hashJoin.open(this.firstInput, this.secondInput, this.buildSideOuterJoin);
	}
543736
public void setFaultTo(String faultTo) {
        try {
            this.faultTo = new EndpointReference(new URI(faultTo));
        } catch (URISyntaxException e) {
            throw new CitrusRuntimeException("Invalid faultTo uri", e);
        }
    }
1168898
@Override
  public final void onBeforeScopeDestruction (@Nonnull final IScope aScopeToBeDestroyed) throws Exception
  {
    if (LOGGER.isDebugEnabled ())
      LOGGER.debug ("onBeforeScopeDestruction for '" + toString () + "' in scope " + aScopeToBeDestroyed.toString ());

    // Check init state
    if (isInInstantiation ())
    {
      if (LOGGER.isWarnEnabled ())
        LOGGER.warn ("Object currently in instantiation is destroyed soon: " + toString ());
    }
    else
      if (!isInstantiated ())
      {
        if (LOGGER.isWarnEnabled ())
          LOGGER.warn ("Object not instantiated is destroyed soon: " + toString ());
      }

    // Check destruction state
    if (isInPreDestruction ())
    {
      if (LOGGER.isErrorEnabled ())
        LOGGER.error ("Object already in pre destruction is destroyed soon again: " + toString ());
    }
    else
      if (isInDestruction ())
      {
        if (LOGGER.isErrorEnabled ())
          LOGGER.error ("Object already in destruction is destroyed soon again: " + toString ());
      }
      else
        if (isDestroyed ())
        {
          if (LOGGER.isErrorEnabled ())
            LOGGER.error ("Object already destroyed is destroyed soon again: " + toString ());
        }

    setInPreDestruction (true);

    onBeforeDestroy (aScopeToBeDestroyed);

    // do not reset PreDestruction - happens in onScopeDestruction
  }
563327
@Override
	public void reopen(FileInputSplit split, Tuple2<Long, Long> state) throws IOException {
		this.open(split);
		this.getOfficeReader().getCurrentParser().setCurrentSheet(state.f0);
		this.getOfficeReader().getCurrentParser().setCurrentRow(state.f1);

	}
611431
void checkRecallValidity() {
    double x0 = recall.exec(this, 0);
    for (int i = 1; i < _nBins; i++) {
      double x1 = recall.exec(this, i);
      if (x0 > x1)
        throw new H2OIllegalArgumentException(String.valueOf(i), "recall", x0 + " > " + x1);
      x0 = x1;
    }
  }
7944
def _loop_once(self, timeout=None):
        
        _vv and IOLOG.debug('%r._loop_once(%r, %r)',
                            self, timeout, self.poller)
        #IOLOG.debug('readers =\n%s', pformat(self.poller.readers))
        #IOLOG.debug('writers =\n%s', pformat(self.poller.writers))
        for side, func in self.poller.poll(timeout):
            self._call(side.stream, func)
1117111
public void init(WriteStream os)
  {
    _os = os;
    _openCount.set(1);
    
    switch (_peer) {
    case CLIENT:
      _nextStreamId = 1;
      break;
      
    case SERVER:
      _nextStreamId = 2;
      break;
      
    default:
      throw new IllegalStateException(String.valueOf(_peer));
    }

    if (_conn.isHeaderHuffman()) {
      _outHeader = new OutHeaderHuffman(os);
    }
    else {
      _outHeader = new OutHeader(os);
    }
  }
656923
function safelyCallComponentWillUnmount(current, instance) {
    {
      invokeGuardedCallback$2(null, callComponentWillUnmountWithTimerInDev, null, current, instance);
      if (hasCaughtError$1()) {
        var unmountError = clearCaughtError$1();
        captureError(current, unmountError);
      }
    }
  }
329417
function openExplorerinWindows(path, callback) {
    path = path || '=';
    let p = spawn('explorer', [path]);
    p.on('error', (err) => {
        p.kill();
        return callback(err);
    });
}
534213
@Trivial
    public void enactOpen(long openAt) {
        String methodName = "enactOpen";
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled() ) {
            Tr.debug(tc, methodName + " On [ " + path + " ] at [ " + toRelSec(initialAt, openAt) + " (s) ]");
        }

        if ( zipFileState == ZipFileState.OPEN ) { // OPEN -> OPEN
            openDuration += openAt - lastOpenAt;

            lastLastOpenAt = lastOpenAt;
            lastOpenAt = openAt;

            openCount++;

        } else if ( zipFileState == ZipFileState.PENDING ) { // PENDING -> OPEN
            long lastPendDuration = openAt - lastPendAt;
            pendToOpenDuration += lastPendDuration;

            pendToOpenCount++;

            lastLastOpenAt = lastOpenAt;
            lastOpenAt = openAt;

            openCount++;

            zipFileState = ZipFileState.OPEN;

            if ( ZIP_REAPER_COLLECT_TIMINGS ) {
                timing(" Pend Success [ " + toAbsSec(lastPendDuration) + " (s) ]");
            }

        } else if ( zipFileState == ZipFileState.FULLY_CLOSED ) { // FULLY_CLOSED -> OPEN
            if ( firstOpenAt == -1L ) {
                firstOpenAt = openAt;

            } else {
                long lastFullCloseDuration = openAt - lastFullCloseAt;
                fullCloseToOpenDuration += lastFullCloseDuration;

                if ( ZIP_REAPER_COLLECT_TIMINGS ) {
                    long lastPendDuration = ( (lastPendAt == -1L) ? 0 : (lastFullCloseAt - lastPendAt) );
                    timing(" Reopen; Pend [ " + toAbsSec(lastPendDuration) + " (s) ] " +
                           " Close [ " + toAbsSec(lastFullCloseDuration) + " (s) ]");
                }
            }

            fullCloseToOpenCount++;

            lastLastOpenAt = lastOpenAt;
            lastOpenAt = openAt;

            openCount++;

            zipFileState = ZipFileState.OPEN;

        } else {
            throw unknownState();
        }
        

        if ( ZIP_REAPER_COLLECT_TIMINGS ) {
            timing(" Open " + dualTiming(openAt, initialAt) + " " + openState());
        }
    }
713840
def run_once(function, state={}, errors={}):
    """"""
    @six.wraps(function)
    def _wrapper(*args, **kwargs):
        if function in errors:
            # Deliberate use of LBYL.
            six.reraise(*errors[function])

        try:
            return state[function]
        except KeyError:
            try:
                state[function] = result = function(*args, **kwargs)
                return result
            except Exception:
                errors[function] = sys.exc_info()
                raise
    return _wrapper
179261
private Completable initWithCallback(Action1<PartitionAndSeqno> callback) {
    sessionState().setToBeginningWithNoEnd(numPartitions());

    return getSeqnos()
        .doOnNext(callback)
        .reduce(new ArrayList<>(), new Func2<List<Short>, PartitionAndSeqno, List<Short>>() {
          @Override
          public List<Short> call(List<Short> partitions, PartitionAndSeqno partitionAndSeqno) {
            partitions.add(partitionAndSeqno.partition());
            return partitions;
          }
        })
        .flatMap(new Func1<List<Short>, Observable<ByteBuf>>() {
          @Override
          public Observable<ByteBuf> call(List<Short> partitions) {
            return failoverLogs(partitions.toArray(new Short[]{}));
          }
        })
        .map(new Func1<ByteBuf, Short>() {
          @Override
          public Short call(ByteBuf buf) {
            short partition = DcpFailoverLogResponse.vbucket(buf);
            handleFailoverLogResponse(buf);
            buf.release();
            return partition;
          }
        }).last().toCompletable();
  }