PageRenderTime 15ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/protocols/ss7/m3ua/api/src/main/java/org/mobicents/protocols/ss7/m3ua/M3UASelectionKey.java

http://mobicents.googlecode.com/
Java | 120 lines | 11 code | 10 blank | 99 comment | 0 complexity | 64af979e6d0c79ae56559d01ed463d62 MD5 | raw file
Possible License(s): LGPL-3.0, GPL-3.0, LGPL-2.1, GPL-2.0, CC-BY-SA-3.0, CC0-1.0, Apache-2.0, BSD-3-Clause
  1. /*
  2. * JBoss, Home of Professional Open Source
  3. * Copyright 2011, Red Hat, Inc. and individual contributors
  4. * by the @authors tag. See the copyright.txt in the distribution for a
  5. * full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.mobicents.protocols.ss7.m3ua;
  23. /**
  24. * A token representing the registration of a M3UAChannel with a multiplexer.
  25. *
  26. * A selection key is created each time a channel is registered with a selector.
  27. * A key remains valid until it is cancelled by invoking its cancel method, by
  28. * closing its channel, or by closing its selector. Cancelling a key does not
  29. * immediately remove it from its selector.
  30. *
  31. * A selection key is created each time a channel is registered with a selector.
  32. * A key remains valid until it is cancelled by invoking its cancel method, by
  33. * closing its channel, or by closing its selector. Cancelling a key does not
  34. * immediately remove it from its selector
  35. *
  36. * That a selection key's ready set indicates that its channel is ready for some
  37. * operation category is a hint, but not a guarantee, that an operation in such
  38. * a category may be performed by a thread without causing the thread to block.
  39. * A ready set is most likely to be accurate immediately after the completion of
  40. * a selection operation. It is likely to be made inaccurate by external events
  41. * and by I/O operations that are invoked upon the corresponding channel.
  42. *
  43. * @author amit bhayani
  44. * @author kulikov
  45. */
  46. public interface M3UASelectionKey {
  47. /**
  48. * Returns the channel for which this key was created. This method will
  49. * continue to return the channel even after the key is cancelled.
  50. *
  51. * @return This key's channel.
  52. */
  53. public M3UASelectableChannel channel();
  54. /**
  55. * Tests whether this key's channel is ready to accept a new connection.
  56. *
  57. * @return true if, and only if channel ready to accept new connection
  58. */
  59. public boolean isAcceptable();
  60. /**
  61. * Tests whether this key's channel is ready for reading.
  62. *
  63. * @return true if, and only if channel ready for reading
  64. */
  65. public boolean isReadable();
  66. /**
  67. * Tests whether this key's channel is ready for writting.
  68. *
  69. * @return true if, and only if channel ready for writting
  70. */
  71. public boolean isWritable();
  72. /**
  73. * Requests that the registration of this key's channel with its selector be
  74. * cancelled.
  75. */
  76. public void cancel();
  77. /**
  78. * Attaches the given object to this key.
  79. *
  80. * <p>
  81. * An attached object may later be retrieved via the {@link #attachment
  82. * attachment} method. Only one object may be attached at a time; invoking
  83. * this method causes any previous attachment to be discarded. The current
  84. * attachment may be discarded by attaching <tt>null</tt>.
  85. * </p>
  86. *
  87. * @param ob
  88. * The object to be attached; may be <tt>null</tt>
  89. *
  90. * @return The previously-attached object, if any, otherwise <tt>null</tt>
  91. */
  92. public Object attach(Object ob);
  93. /**
  94. * Retrieves the current attachment.
  95. * </p>
  96. *
  97. * @return The object currently attached to this key, or <tt>null</tt> if
  98. * there is no attachment
  99. */
  100. public Object attachment();
  101. /**
  102. * Tells whether or not this key is valid.
  103. *
  104. * <p> A key is valid upon creation and remains so until it is cancelled,
  105. * its channel is closed, or its selector is closed. </p>
  106. *
  107. * @return <tt>true</tt> if, and only if, this key is valid
  108. */
  109. public abstract boolean isValid();
  110. }