Close the webcam.

@return True if webcam has been open, false otherwise
177921
public boolean close() {

		if (open.compareAndSet(true, false)) {

			LOG.debug("Closing webcam {}", getName());

			assert lock != null;

			// close webcam

			WebcamCloseTask task = new WebcamCloseTask(driver, device);
			try {
				task.close();
			} catch (InterruptedException e) {
				open.set(true);
				LOG.debug("Thread has been interrupted before webcam was closed!", e);
				return false;
			} catch (WebcamException e) {
				open.set(true);
				throw e;
			}

			// stop updater
			if (asynchronous) {
				updater.stop();
			}

			// remove shutdown hook (it's not more necessary)
			removeShutdownHook();

			// unlock webcam so other Java processes can start using it
			lock.unlock();

			// notify listeners

			WebcamEvent we = new WebcamEvent(WebcamEventType.CLOSED, this);
			Iterator<WebcamListener> wli = listeners.iterator();
			WebcamListener l = null;

			while (wli.hasNext()) {
				l = wli.next();
				try {
					l.webcamClosed(we);
				} catch (Exception e) {
					LOG.error(String.format("Notify webcam closed, exception when calling %s listener", l.getClass()), e);
				}
			}

			notificator.shutdown();
			while (!notificator.isTerminated()) {
				try {
					notificator.awaitTermination(100, TimeUnit.MILLISECONDS);
				} catch (InterruptedException e) {
					return false;
				}
			}

			LOG.debug("Webcam {} has been closed", getName());

		} else {
			LOG.debug("Webcam {} is already closed", getName());
		}

		return true;
	}
343713
public boolean stop() {
        if (mThread != null) {
            mThread.interrupt();
            if (mThreadPool != null) {

                try {
                    mThreadPool.shutdownNow();
                } catch (SecurityException e) {
                    Log.w(LOG_TAG, "Could not stop all view server threads");
                }
            }

            mThreadPool = null;
            mThread = null;

            try {
                mServer.close();
                mServer = null;
                return true;
            } catch (IOException e) {
                Log.w(LOG_TAG, "Could not close the view server");
            }
        }

        mWindowsLock.writeLock().lock();
        try {
            mWindows.clear();
        } finally {
            mWindowsLock.writeLock().unlock();
        }

        mFocusLock.writeLock().lock();
        try {
            mFocusedWindow = null;
        } finally {
            mFocusLock.writeLock().unlock();
        }

        return false;
    }
1004164
public boolean isStreamClosed() {
        if (this.myID == 0 && !endStream) {
            return false;
        }

        if (state == StreamState.CLOSED) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "isStreamClosed stream closed; " + streamId());
            }
            return true;
        }

        boolean rc = muxLink.checkIfGoAwaySendingOrClosing();

        if (rc == true) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "isStreamClosed stream closed via muxLink check; " + streamId());
            }
        }

        return rc;
    }
704553
public AioSession closeOut() {
		if (null != this.channel) {
			try {
				this.channel.shutdownOutput();
			} catch (IOException e) {
				throw new IORuntimeException(e);
			}
		}
		return this;
	}
1010943
def stop(self):
        
        # Check that everything is running
        if not self._running:
            logging.warning('Colorized PhoXi not running. Aborting stop')
            return False

        self._webcam.stop()
        self._phoxi.stop()

        return True
1338881
public AioSession closeIn() {
		if (null != this.channel) {
			try {
				this.channel.shutdownInput();
			} catch (IOException e) {
				throw new IORuntimeException(e);
			}
		}
		return this;
	}
400209
@Override
    public void close() {
        log.debug("close");
        // spawn a thread to finish up our flv writer work
        boolean locked = false;
        try {
            // try to get a lock within x time
            locked = lock.tryAcquire(500L, TimeUnit.MILLISECONDS);
            if (locked) {
                finalizeFlv();
            }
        } catch (InterruptedException e) {
            log.warn("Exception acquiring lock", e);
        } finally {
            if (locked) {
                lock.release();
            }
            if (executor != null && !executor.isTerminated()) {
                executor.shutdown();
            }
        }
    }
1075963
@Override
    public void close() {
        if (!closed) {
            closed = true;
            try {
                response.getOutputStream().close();
                HttpServletRequest req = (HttpServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
                if (req != null) {
                    req.getAsyncContext().complete();
                }
            } catch (Exception ex) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Failed to close response stream", ex);
                }
            } finally {
                ServerProviderFactory.releaseRequestState(message);
            }
            
            //TODO: remove from all broadcasters
        }

    }
737108
public function close()
    {
        if($this->getType() == 'temp')
        {
            if(parent::close() == true)
            {
                //Only unlink temporary files
                if($this->getType() == 'temp') {
                    $this->unlink();
                }

                return true;
            }
        }

        if($this->getType() == 'memory') {
            return $this->flush();
        }

        return false;
    }
174199
public void close() {
    try {
      if (is != null) is.close();
    } catch (IOException e) {
      log.error(null, e);
      throw new RuntimeException(e);
    }
    isClosed = true;
  }
525472
function _close()
	{
		if ($this->_connectionID) $this->_connectionID->Close();
		$this->_connectionID = false;
		return true;
	}
81020
public synchronized void close() {
        if (!closed && channel != null) {
            ConnectionWatchdog watchdog = channel.getPipeline().get(ConnectionWatchdog.class);
            watchdog.setReconnect(false);
            closed = true;
            channel.close();
        }
    }
1159561
public boolean release() {

    if (this.released) {
      // already (marked as) released...
      return false;
    }
    this.released = true;
    if (this.childCount == 0) {
      if (this.parent == null) {
        return true;
      } else {
        assert (this.parent.childCount > 0);
        this.parent.childCount--;
        if ((this.parent.childCount == 0) && (this.parent.released)) {
          return true;
        }
      }
    }
    return false;
  }
757646
protected boolean changeCameraConfiguration() {
		Log.i(TAG,"CameraCaptureSession.changeCameraConfiguration()");
		if (Looper.getMainLooper().getThread() != Thread.currentThread()) {
			throw new RuntimeException("Not on main looper! Modify code to remove assumptions");
		}
		if (null == open.mCameraDevice || null == open.mCameraSize) {
			Log.i(TAG,"  aborting changeCameraConfiguration. Camera not open yet.");
			return false;
		}

		try {
			open.mLock.lock();
			// configuration change still in progress
			if( null == mPreviewSession ) {
				Log.i(TAG," Abort camera configuration change. Not ready yet");
				return false;
			}
			createCaptureSession();
		} catch (CameraAccessException e) {
			e.printStackTrace();
		} finally {
			open.mLock.unlock();
		}
		return true;
	}
46308
public final <T extends ReleasableInputStream> T disableClose() {
        this.closeDisabled = true;
        @SuppressWarnings("unchecked")
        T t = (T)this;
        return t;
    }
673522
function close()
    {
        if ($this->_opened) {
            mcal_close($this->_stream);
            $this->_opened = false;
        }

        return ($this->_opened === false);
    }
678568
public void stop() {

		if (!started.compareAndSet(true, false)) {
			return;
		}

		webcam.removeWebcamListener(this);

		LOG.debug("Stopping panel rendering and closing attached webcam");

		try {
			updater.stop();
		} catch (InterruptedException e) {
			throw new RuntimeException(e);
		}

		image = null;

		final SwingWorker<Void, Void> worker = new SwingWorker<Void, Void>() {

			@Override
			protected Void doInBackground() throws Exception {

				try {
					if (webcam.isOpen()) {
						errored = !webcam.close();
					}
				} catch (WebcamException e) {
					errored = true;
					throw e;
				} finally {
					repaintPanel();
				}

				return null;
			}
		};
		worker.execute();
	}