private void CloseSocket() { try { if (_socket != null) { _socket.Close(); } } catch (Db4oIOException e) { } }
public virtual void Run() { try { Socket4Adapter socket = stream.CreateParallelSocket(); MsgBlob msg = null; // no blobLock synchronisation here, since our first msg is valid lock (queue) { msg = (MsgBlob)queue.Next(); } while (msg != null) { msg.Write(socket); msg.ProcessClient(socket); lock (stream._blobLock) { lock (queue) { msg = (MsgBlob)queue.Next(); } if (msg == null) { terminated = true; Msg.CloseSocket.Write(socket); try { socket.Close(); } catch (Exception) { } } } } } catch (Exception e) { Sharpen.Runtime.PrintStackTrace(e); } }
public virtual bool Close() { lock (this) { if (_isClosed) { return(true); } _isClosed = true; if (_socket != null) { try { _socket.Close(); } catch (Db4oIOException) { } } _synchronousMessageQueue.Stop(); _asynchronousMessageQueue.Stop(); return(true); } }
protected override void Close2() { if ((!_singleThreaded) && (_messageDispatcher == null || !_messageDispatcher.IsMessageDispatcherAlive ())) { StopHeartBeat(); ShutdownObjectContainer(); return; } try { Commit1(_transaction); } catch (Exception e) { Exceptions4.CatchAllExceptDb4oException(e); } try { Write(Msg.Close); } catch (Exception e) { Exceptions4.CatchAllExceptDb4oException(e); } ShutDownCommunicationRessources(); try { _socket.Close(); } catch (Exception e) { Exceptions4.CatchAllExceptDb4oException(e); } ShutdownObjectContainer(); }
/// <exception cref="System.Exception"></exception> private void AssertReadClose(Socket4Adapter socketToBeClosed, ICodeBlock codeBlock ) { var thread = new CatchAllThread (codeBlock); thread.EnsureStarted(); socketToBeClosed.Close(); thread.Join(); Assert.IsInstanceOf(typeof (Db4oIOException), thread.Caught()); }
private void AssertWriteClose(Socket4Adapter socketToBeClosed, ICodeBlock codeBlock ) { socketToBeClosed.Close(); Assert.Expect(typeof (Db4oIOException), new _ICodeBlock_102(codeBlock)); }