Commit Graph

53 Commits

Author SHA1 Message Date
Trustin Lee
499033d44f Add a shortcut method for collision-free naming 2014-02-13 15:17:09 -08:00
Trustin Lee
b533a1361b Replace UniqueName with Constant and ConstantPool
- Proposed fix for #1824

UniqueName and its subtypes do not allow getting the previously registered instance.  For example, let's assume that a user is running his/her application in an OSGi container with Netty bundles and his server bundle.  Whenever the server bundle is reloaded, the server will try to create a new AttributeKey instance with the same name.  However, Netty bundles were not reloaded at all, so AttributeKey will complain that the name is taken already (by the previously loaded bundle.)

To fix this problem:

- Replaced UniqueName with Constant, AbstractConstant, and ConstantPool.  Better name and better design.

- Sctp/Udt/RxtxChannelOption is not a ChannelOption anymore.  They are just constant providers and ChannelOption is final now.  It's because caching anything that's from outside of netty-transport will lead to ClassCastException on reload, because ChannelOption's constant pool will keep all option objects for reuse.

- Signal implements Constant because we can't ensure its uniqueness anymore by relying on the exception raised by UniqueName's constructor.
2014-02-13 15:14:34 -08:00
Trustin Lee
309ee68c21 Fix a race condition in DefaultPromise
.. which occurs when a user adds a listener from different threads after the promise is done and the notifications for the listeners, that were added before the promise is done, is in progress.  For instance:

   Thread-1: p.addListener(listenerA);
   Thread-1: p.setSuccess(null);
   Thread-2: p.addListener(listenerB);
   Thread-2: p.executor.execute(taskNotifyListenerB);
   Thread-1: p.executor.execute(taskNotifyListenerA);

taskNotifyListenerB should not really notify listenerB until taskNotifyListenerA is finished.

To fix this issue:

- Change the semantic of (listeners == null) to determine if the early
  listeners [1] were notified
- If a late listener is added before the early listeners are notified,
  the notification of the late listener is deferred until the early
  listeners are notified (i.e. until listeners == null)
- The late listeners with deferred notifications are stored in a lazily
  instantiated queue to preserve ordering, and then are notified once
  the early listeners are notified.

[1] the listeners that were added before the promise is done
[2] the listeners that were added after the promise is done
2014-02-06 22:05:24 -08:00
Trustin Lee
c4c71e6d28 Fix the potential copyright issue in SocksCommonUtils
- Add StringUtil.toHexString() methods which are based on LoggingHandler's lookup table implementation, and use it wherever possible
2014-02-06 15:00:06 -08:00
Valentin Kovalenko
40f4b5c9db Restore of interrupt status after catch of InterruptedException was added 2014-02-03 06:58:15 +01:00
Norman Maurer
05c10fae05 Replace usage of StringBuilder by AppendableCharSequence for performance reasons 2013-12-03 12:04:07 +01:00
Norman Maurer
16d32ed33a [#1959] Proposed fix to correctly handle timeouts that overflow the ticks in the wheel 2013-10-31 06:27:17 +01:00
Trustin Lee
1c2352e6a0 Replace constructor calls on UniqueName and its subtypes with valueOf() wherever possible 2013-10-25 20:58:53 +09:00
Trustin Lee
57d591d188 Fix checkstyle 2013-07-18 14:05:41 +09:00
Trustin Lee
0f2542ded5 Fix StackOverflowError raised by DefaultPromise.notifyListeners() when ImmediateEventExecutor was used
- Fixed #1602
2013-07-18 14:03:48 +09:00
Trustin Lee
1749210985 Add GlobalEventExecutor
- Related issue: #1389
- Also extracted SingleThreadEventExecutor.ScheduledFutureTask into a top level class for a reuse
2013-06-12 06:40:01 +09:00
Trustin Lee
2600f46fd7 Fix checkstyle 2013-04-11 17:54:20 +09:00
Trustin Lee
15ac4127e4 Remove @Ignore and add expected / Fix inspector warnings 2013-04-11 17:29:37 +09:00
Norman Maurer
73db1f886d [#1247] Add test which shows the problem with concrete classes that pass in the type based on a generic 2013-04-10 07:08:42 +02:00
Andrei Pozolotin
a3e760a003 fix #1234 - duplicate package-info.java errors in eclipse requires release of netty-build v 19 and netty-parent update. 2013-04-05 05:38:05 +09:00
Prajwal Tuladhar
05850da863 enable checkstyle for test source directory and fix checkstyle errors 2013-03-30 13:18:57 +01:00
Prajwal Tuladhar
915cb8b55c [#744] Port fixes from Akka to HashedWheelTimer
port fix from Akka with following commits:
*
https://github.com/akka/akka/commit/cb4e3536b0ed3483bd3636d7789c0ddcadaf
a2da
*
https://github.com/akka/akka/commit/7e590f3071bdf89a4aa9d7d262bac8923d85
e754

And also use constants for worker state for time instead of numeric.
2013-03-22 12:26:15 +01:00
Trustin Lee
fa02ffddae Remove TaskScheduler and ImmediateEventExecutor that requires TaskScheduler
- Related issue: #817
2013-03-22 09:06:08 +09:00
Trustin Lee
4323fea5fb Fix a bug where TypeParameterMatcher does not detect the case where the type parameter is derived from an outer class
- Fixes #1153
2013-03-14 07:22:44 +09:00
Norman Maurer
17ebbdec20 Let ChannelGroupFuture extends ChannelFuture and ChannelGroupFutureListener GenericFutureListener 2013-03-12 08:35:39 +01:00
Trustin Lee
ed825de4bf Fix a bug where TypeParameterMatcher raises ClassCastException when an instance with raw type parameter is given 2013-03-09 09:19:34 +09:00
Trustin Lee
b712b030fa Fix a bug where TypeParameterMatcher fails when a type parameter is an array
- Fixes #1103
2013-02-28 10:29:03 -08:00
Trustin Lee
671f9d48d4 Use ConcurrentHashMapV8 wherever possible
- Fixes #1052
2013-02-26 15:54:51 -08:00
Trustin Lee
f67441354a Move logging classes from internal to internal.logging
.. because internal is crowded
2013-02-26 14:54:25 -08:00
Trustin Lee
742db71a52 Fix IllegalAccessError when Javassist is used 2013-02-13 23:56:55 -08:00
Trustin Lee
53c27ef5ae More robust type parameter detection
- Also removed unnecessary constructors which were added due to incomplete type parameter detection logic
2013-02-13 19:02:55 -08:00
Trustin Lee
b4f4b95739 Move io.netty.logging to io.netty.internal / Move Signal out of internal because we use it in Channel*MessageAdapters 2013-02-11 20:08:18 +09:00
Trustin Lee
24acfe7008 Remove io.netty.monitor as discussed in #922 2013-01-18 11:08:57 +09:00
Trustin Lee
eb337ff5a7 Fix various inspection warnings 2013-01-10 15:23:58 +09:00
alexey
738d382fbc Added test cases for NetUtil methods, if we can`t convertAddress we return null 2012-12-29 18:31:53 +01:00
Norman Maurer
0fb0037eab Rename IpAddresses to NetUtil 2012-12-29 18:25:32 +01:00
Norman Maurer
5d13c7d27b Merge IPUtil and NetworkConstants into IpAddresses and also make naming of methods consistent 2012-12-29 18:17:33 +01:00
Trustin Lee
6b9f7065a2 Simpler and more comprehensive method naming in monitor 2012-12-26 13:48:29 +09:00
Trustin Lee
6f2840193a Fix inspection warnings related with JUnit usage 2012-11-12 12:45:06 +09:00
Trustin Lee
aedf8790c3 Fix various Javadoc issues / Do not use argN parameter names 2012-11-12 12:26:19 +09:00
Trustin Lee
5d45880b9e Fix a failing test
There's practically no way to test if the detected localhost is good if the user's environment is broken.
2012-11-10 08:50:21 +09:00
Trustin Lee
23883d25ee Remove various unnecessary qualifiers 2012-11-10 07:03:07 +09:00
Trustin Lee
e21dc5925d Replace dynamic regular expressions with precompiled Patterns or new StringUtil.split() 2012-11-10 00:41:22 +09:00
Norman Maurer
5a8486e39c Correct test 2012-10-27 19:57:59 +02:00
Olaf Bergner
ddd0734f43 Issue #65: Provide distribution stats for HashedWheelTimer
First cut at implementing a generic abstraction layer for pluggable
metrics providers. This first cut is closely modeled after Yammer
Metrics. It remains to be seen if it is indeed flexibel enough to
support other providers.
Provide a default implementation of this new abstraction layer
based on Yammer Metrics.
Support pluggable Monitoring Providers using Java 6's ServiceLoader.
Use this new abstraction layer to provide stats on (a) number of
Timeouts executed per second and (b) distribution of absolute
deviation between scheduled and actual Timeout execution time in
HashedWheelTimer.
 * Interface ValueDistributionMonitor, a monitor for histograms.
 * Interface EventRateMonitor, a monitor for measuring the rate per time
   unit of specific events.
 * Interface ValueMonitor, a monitor for tracking an arbitrary datum's
   current value
 * Interface CounterMonitor, a monitor for incrementing/decrementing a
   long value
 * Interface MonitorRegistry, a registry for monitors that serves as the
   interface between Netty and concrete metrics providers as e.g. Yammer
   Metrics.
 * Interface MonitorRegistryFactory, to be implemented by metrics
   providers.
 * Document how to use Netty's new monitoring support in javadocs for
   package io.netty.monitor.
2012-10-25 23:10:15 +02:00
Trustin Lee
f1c07dbf0b Fix more compiler warnings 2012-09-01 17:00:24 +09:00
Trustin Lee
85f8247cef Fix compiler warnings 2012-09-01 16:58:33 +09:00
Cruz Julian Bishop
11d9334dee Adds some more test cases
This adds test cases to test against:

	1: DefaultAttributeMap / DefaultAttribute (100%)
	2: NetworkConstants (61.9%, functionally 100%)
	3: StringUtil (50%, functionally 100%)

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
2012-08-21 10:20:21 +10:00
Cruz Julian Bishop
b3a9ee1d71 Removes an unneeded assertion in UniqueNameTest
Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
2012-08-21 09:34:52 +10:00
Cruz Julian Bishop
6e3b9ed634 More test cases: Round one
This tests the following classes more:

1: InternalLoggerFactoryTest
	Tests InternalLoggerFactory.getInstance(Class)

2: UniqueName
	Paired with #543, this achieves 100% code coverage with tests

Signed-off-by: Cruz Julian Bishop <cruzjbishop@gmail.com>
2012-08-21 09:32:00 +10:00
Trustin Lee
aef7a14852 Merge the pull request #432 manually
- Add UniqueNameTest
- Add JavaDoc for UniqueName
2012-08-17 12:42:30 +09:00
Trustin Lee
8dc1f321cb Remove unused classes in util.internal 2012-07-07 13:41:49 +09:00
Trustin Lee
1eced1e9e3 Update license headers 2012-06-04 13:31:44 -07:00
Trustin Lee
77274ae743 Automated code clean-up 2012-05-31 12:03:01 -07:00
Trustin Lee
dd2e36e5d9 Remove unused or unmaintainable internal classes 2012-05-15 17:10:54 +09:00