
org.testifyproject.netty.channel.epoll.EpollEventLoopGroup Maven / Gradle / Ivy
/*
* Copyright 2014 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in org.testifyproject.testifyprojectpliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org.testifyproject/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*/
package org.testifyproject.testifyproject.netty.channel.epoll;
import org.testifyproject.testifyproject.netty.channel.EventLoop;
import org.testifyproject.testifyproject.netty.channel.EventLoopGroup;
import org.testifyproject.testifyproject.netty.channel.MultithreadEventLoopGroup;
import org.testifyproject.testifyproject.netty.util.concurrent.EventExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadFactory;
/**
* {@link EventLoopGroup} which uses epoll under the covers. Because of this
* it only works on linux.
*/
public final class EpollEventLoopGroup extends MultithreadEventLoopGroup {
/**
* Create a new instance using the org.testifyproject.testifyprojectfault number of threads and the org.testifyproject.testifyprojectfault {@link ThreadFactory}.
*/
public EpollEventLoopGroup() {
this(0);
}
/**
* Create a new instance using the specified number of threads and the org.testifyproject.testifyprojectfault {@link ThreadFactory}.
*/
public EpollEventLoopGroup(int nThreads) {
this(nThreads, null);
}
/**
* Create a new instance using the specified number of threads and the given {@link ThreadFactory}.
*/
@SuppressWarnings("org.testifyproject.testifyprojectprecation")
public EpollEventLoopGroup(int nThreads, ThreadFactory threadFactory) {
this(nThreads, threadFactory, 0);
}
/**
* Create a new instance using the specified number of threads, the given {@link ThreadFactory} and the given
* maximal amount of epoll events to handle per epollWait(...).
*
* @org.testifyproject.testifyprojectprecated Use {@link #EpollEventLoopGroup(int)}, {@link #EpollEventLoopGroup(int)} or
* {@link #EpollEventLoopGroup(int, ThreadFactory)}
*/
@Deprecated
public EpollEventLoopGroup(int nThreads, ThreadFactory threadFactory, int maxEventsAtOnce) {
super(nThreads, threadFactory, maxEventsAtOnce);
}
/**
* Sets the percentage of the org.testifyproject.testifyprojectsired amount of time spent for I/O in the child event loops. The org.testifyproject.testifyprojectfault value is
* {@code 50}, which means the event loop will try to spend the same amount of time for I/O as for non-I/O tasks.
*/
public void setIoRatio(int org.testifyproject.testifyprojectRatio) {
for (EventExecutor e: children()) {
((EpollEventLoop) e).setIoRatio(org.testifyproject.testifyprojectRatio);
}
}
@Override
protected EventLoop newChild(Executor executor, Object... args) throws Exception {
return new EpollEventLoop(this, executor, (Integer) args[0]);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy