Mercurial Hosting > luan
comparison src/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java @ 820:8e9db0bbf4f9
remove org.eclipse.jetty.util.log and upgrade slf4j
| author | Franklin Schmidt <fschmidt@gmail.com> |
|---|---|
| date | Tue, 13 Sep 2016 23:13:06 -0600 |
| parents | 3428c60d7cfc |
| children | 6b210bb66c63 |
comparison
equal
deleted
inserted
replaced
| 819:17bd0b170ed6 | 820:8e9db0bbf4f9 |
|---|---|
| 30 import org.eclipse.jetty.io.Buffer; | 30 import org.eclipse.jetty.io.Buffer; |
| 31 import org.eclipse.jetty.io.ConnectedEndPoint; | 31 import org.eclipse.jetty.io.ConnectedEndPoint; |
| 32 import org.eclipse.jetty.io.Connection; | 32 import org.eclipse.jetty.io.Connection; |
| 33 import org.eclipse.jetty.io.EofException; | 33 import org.eclipse.jetty.io.EofException; |
| 34 import org.eclipse.jetty.io.nio.SelectorManager.SelectSet; | 34 import org.eclipse.jetty.io.nio.SelectorManager.SelectSet; |
| 35 import org.eclipse.jetty.util.log.Log; | 35 import org.slf4j.Logger; |
| 36 import org.eclipse.jetty.util.log.Logger; | 36 import org.slf4j.LoggerFactory; |
| 37 import org.eclipse.jetty.util.thread.Timeout.Task; | 37 import org.eclipse.jetty.util.thread.Timeout.Task; |
| 38 | 38 |
| 39 /* ------------------------------------------------------------ */ | 39 /* ------------------------------------------------------------ */ |
| 40 /** | 40 /** |
| 41 * An Endpoint that can be scheduled by {@link SelectorManager}. | 41 * An Endpoint that can be scheduled by {@link SelectorManager}. |
| 42 */ | 42 */ |
| 43 public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPoint, ConnectedEndPoint | 43 public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPoint, ConnectedEndPoint |
| 44 { | 44 { |
| 45 public static final Logger LOG=Log.getLogger("org.eclipse.jetty.io.nio"); | 45 public static final Logger LOG=LoggerFactory.getLogger("org.eclipse.jetty.io.nio"); |
| 46 | 46 |
| 47 private final boolean WORK_AROUND_JVM_BUG_6346658 = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("win"); | 47 private final boolean WORK_AROUND_JVM_BUG_6346658 = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("win"); |
| 48 private final SelectorManager.SelectSet _selectSet; | 48 private final SelectorManager.SelectSet _selectSet; |
| 49 private final SelectorManager _manager; | 49 private final SelectorManager _manager; |
| 50 private SelectionKey _key; | 50 private SelectionKey _key; |
| 448 updateKey(); | 448 updateKey(); |
| 449 this.wait(timeoutMs>0?(end-now):10000); | 449 this.wait(timeoutMs>0?(end-now):10000); |
| 450 } | 450 } |
| 451 catch (final InterruptedException e) | 451 catch (final InterruptedException e) |
| 452 { | 452 { |
| 453 LOG.warn(e); | 453 LOG.warn("",e); |
| 454 if (_interruptable) | 454 if (_interruptable) |
| 455 throw new InterruptedIOException(){{this.initCause(e);}}; | 455 throw new InterruptedIOException(){{this.initCause(e);}}; |
| 456 } | 456 } |
| 457 finally | 457 finally |
| 458 { | 458 { |
| 498 updateKey(); | 498 updateKey(); |
| 499 this.wait(timeoutMs>0?(end-now):10000); | 499 this.wait(timeoutMs>0?(end-now):10000); |
| 500 } | 500 } |
| 501 catch (final InterruptedException e) | 501 catch (final InterruptedException e) |
| 502 { | 502 { |
| 503 LOG.warn(e); | 503 LOG.warn("",e); |
| 504 if (_interruptable) | 504 if (_interruptable) |
| 505 throw new InterruptedIOException(){{this.initCause(e);}}; | 505 throw new InterruptedIOException(){{this.initCause(e);}}; |
| 506 } | 506 } |
| 507 finally | 507 finally |
| 508 { | 508 { |
| 593 current_ops = ((_key!=null && _key.isValid())?_key.interestOps():-1); | 593 current_ops = ((_key!=null && _key.isValid())?_key.interestOps():-1); |
| 594 } | 594 } |
| 595 catch(Exception e) | 595 catch(Exception e) |
| 596 { | 596 { |
| 597 _key=null; | 597 _key=null; |
| 598 LOG.ignore(e); | 598 LOG.trace("",e); |
| 599 } | 599 } |
| 600 } | 600 } |
| 601 changed=_interestOps!=current_ops; | 601 changed=_interestOps!=current_ops; |
| 602 } | 602 } |
| 603 | 603 |
| 634 { | 634 { |
| 635 _key=((SelectableChannel)getChannel()).register(_selectSet.getSelector(),_interestOps,this); | 635 _key=((SelectableChannel)getChannel()).register(_selectSet.getSelector(),_interestOps,this); |
| 636 } | 636 } |
| 637 catch (Exception e) | 637 catch (Exception e) |
| 638 { | 638 { |
| 639 LOG.ignore(e); | 639 LOG.trace("",e); |
| 640 if (_key!=null && _key.isValid()) | 640 if (_key!=null && _key.isValid()) |
| 641 { | 641 { |
| 642 _key.cancel(); | 642 _key.cancel(); |
| 643 } | 643 } |
| 644 | 644 |
| 705 break; | 705 break; |
| 706 } | 706 } |
| 707 } | 707 } |
| 708 catch (ClosedChannelException e) | 708 catch (ClosedChannelException e) |
| 709 { | 709 { |
| 710 LOG.ignore(e); | 710 LOG.trace("",e); |
| 711 } | 711 } |
| 712 catch (EofException e) | 712 catch (EofException e) |
| 713 { | 713 { |
| 714 LOG.debug("EOF", e); | 714 LOG.debug("EOF", e); |
| 715 try{close();} | 715 try{close();} |
| 716 catch(IOException e2){LOG.ignore(e2);} | 716 catch(IOException e2){LOG.trace("",e2);} |
| 717 } | 717 } |
| 718 catch (IOException e) | 718 catch (IOException e) |
| 719 { | 719 { |
| 720 LOG.warn(e.toString()); | 720 LOG.warn(e.toString()); |
| 721 try{close();} | 721 try{close();} |
| 722 catch(IOException e2){LOG.ignore(e2);} | 722 catch(IOException e2){LOG.trace("",e2);} |
| 723 } | 723 } |
| 724 catch (Throwable e) | 724 catch (Throwable e) |
| 725 { | 725 { |
| 726 LOG.warn("handle failed", e); | 726 LOG.warn("handle failed", e); |
| 727 try{close();} | 727 try{close();} |
| 728 catch(IOException e2){LOG.ignore(e2);} | 728 catch(IOException e2){LOG.trace("",e2);} |
| 729 } | 729 } |
| 730 finally | 730 finally |
| 731 { | 731 { |
| 732 if (!_ishut && isInputShutdown() && isOpen()) | 732 if (!_ishut && isInputShutdown() && isOpen()) |
| 733 { | 733 { |
| 738 } | 738 } |
| 739 catch(Throwable x) | 739 catch(Throwable x) |
| 740 { | 740 { |
| 741 LOG.warn("onInputShutdown failed", x); | 741 LOG.warn("onInputShutdown failed", x); |
| 742 try{close();} | 742 try{close();} |
| 743 catch(IOException e2){LOG.ignore(e2);} | 743 catch(IOException e2){LOG.trace("",e2);} |
| 744 } | 744 } |
| 745 finally | 745 finally |
| 746 { | 746 { |
| 747 updateKey(); | 747 updateKey(); |
| 748 } | 748 } |
| 785 if (key!=null) | 785 if (key!=null) |
| 786 key.cancel(); | 786 key.cancel(); |
| 787 } | 787 } |
| 788 catch (Throwable e) | 788 catch (Throwable e) |
| 789 { | 789 { |
| 790 LOG.ignore(e); | 790 LOG.trace("",e); |
| 791 } | 791 } |
| 792 } | 792 } |
| 793 | 793 |
| 794 try | 794 try |
| 795 { | 795 { |
| 796 super.close(); | 796 super.close(); |
| 797 } | 797 } |
| 798 catch (IOException e) | 798 catch (IOException e) |
| 799 { | 799 { |
| 800 LOG.ignore(e); | 800 LOG.trace("",e); |
| 801 } | 801 } |
| 802 finally | 802 finally |
| 803 { | 803 { |
| 804 updateKey(); | 804 updateKey(); |
| 805 } | 805 } |
