本文整理汇总了C#中IRunnable类的典型用法代码示例。如果您正苦于以下问题:C# IRunnable类的具体用法?C# IRunnable怎么用?C# IRunnable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRunnable类属于命名空间,在下文中一共展示了IRunnable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RejectedExecution
/// <summary>
/// Obtains and ignores the next task that the <paramref name="executor"/>
/// would otherwise execute, if one is immediately available,
/// and then retries execution of task <paramref name="runnable"/>, unless the <paramref name="executor"/>
/// is shut down, in which case task <paramref name="runnable"/> is instead discarded.
/// </summary>
/// <param name="runnable">the <see cref="Spring.Threading.IRunnable"/> task requested to be executed</param>
/// <param name="executor">the <see cref="Spring.Threading.Execution.ThreadPoolExecutor"/> attempting to execute this task</param>
public virtual void RejectedExecution(IRunnable runnable, ThreadPoolExecutor executor)
{
if (executor.IsShutdown) return;
IRunnable head;
executor.Queue.Poll(out head);
executor.Execute(runnable);
}
开发者ID:nobuyukinyuu,项目名称:diddy,代码行数:15,代码来源:DiscardOldestPolicy.cs
示例2: CacheHostEngine
/// <summary>
/// The constructor.
/// </summary>
/// <param name="cacheHostInformationPoller">The cache host information poller.</param>
/// <param name="memCache">The mem cache to use for storing objects.</param>
/// <param name="clientToCacheServiceHost">The client to cache service host.</param>
/// <param name="cacheManagerClient">The cache manager client.</param>
public CacheHostEngine(IRunnable cacheHostInformationPoller, MemCache memCache, ServiceHost clientToCacheServiceHost)
{
// Sanitize
if (cacheHostInformationPoller == null)
{
throw new ArgumentNullException("cacheHostInformationPoller");
}
if (memCache == null)
{
throw new ArgumentNullException("memCache");
}
if (clientToCacheServiceHost == null)
{
throw new ArgumentNullException("clientToCacheServiceHost");
}
// Set the cache host information poller
_cacheHostInformationPoller = cacheHostInformationPoller;
// Set the mem cache container instance
MemCacheContainer.Instance = memCache;
// Initialize the service hosts
_clientToCacheServiceHost = clientToCacheServiceHost;
}
开发者ID:nategreenwood,项目名称:dache,代码行数:32,代码来源:CacheHostEngine.cs
示例3: NewThread
public Thread NewThread (IRunnable r)
{
Thread t = new Thread (r);
t.SetDaemon (true);
t.Start ();
return t;
}
开发者ID:Cyber-Forensic,项目名称:Potato,代码行数:7,代码来源:ThreadFactory.cs
示例4: RunnableTask
/**
* Builds the task.
*
* @param runnable
* The wrapped Runnable object.
* @throws InvalidPatternException
* If the supplied pattern is not valid.
*/
public RunnableTask(IRunnable runnable)
{
if (runnable == null)
throw new ArgumentNullException("runnable", "runnable is null.");
this._runnable = runnable;
}
开发者ID:tupunco,项目名称:Tup.Cron4Net,代码行数:15,代码来源:RunnableTask.cs
示例5: Sync
public override void Sync(IRunnable runnable)
{
lock (_bin)
{
base.Sync(runnable);
}
}
开发者ID:erdincay,项目名称:db4o,代码行数:7,代码来源:SynchronizedBin.cs
示例6: postOnAnimation
public static void postOnAnimation(View view, IRunnable runnable) {
if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.JellyBean) {
SDK16.postOnAnimation(view, runnable);
} else {
view.PostDelayed(runnable, 16);
}
}
开发者ID:skywolf888,项目名称:Android-PullToRefresh.Net,代码行数:7,代码来源:ViewCompat.cs
示例7: produce
private Object produce(IRunnable runnable, Object result)
{
var producers = runnableManager.GetProducers(runnable);
var converter = producers.FirstOrDefault(c => c.IsConvertable(result));
if (converter == null) return result;
return converter.Convert(result);
}
开发者ID:szabototo89,项目名称:CodeSharper,代码行数:7,代码来源:StandardExecutor.cs
示例8: PostRunnable
// ===========================================================
// Methods
// ===========================================================
public void PostRunnable(/* final */ IRunnable pRunnable)
{
lock (_methodLock)
{
this.mRunnables.Add(pRunnable);
}
}
开发者ID:jamesburton,项目名称:AndEngine.net,代码行数:11,代码来源:RunnableHandler.cs
示例9: SetUp
public void SetUp()
{
_queue = MockRepository.GenerateStub<IBlockingQueue<IRunnable>>();
_runnable = MockRepository.GenerateMock<IRunnable>();
_callerRunsPolicy = new ThreadPoolExecutor.CallerRunsPolicy();
_threadPoolExecutor = new ThreadPoolExecutor(1, 1, TimeSpan.FromSeconds(1), _queue);
}
开发者ID:rlxrlxrlx,项目名称:spring-net-threading,代码行数:7,代码来源:CallerRunsPolicyTests.cs
示例10: consume
private Object consume(IRunnable runnable, Object parameter)
{
var consumers = runnableManager.GetConsumers(runnable);
var converter = consumers.FirstOrDefault(c => c.IsConvertable(parameter));
if (converter == null) return ExecuteRunnable(runnable, parameter);
return converter.Convert(parameter, param => ExecuteRunnable(runnable, param));
}
开发者ID:szabototo89,项目名称:CodeSharper,代码行数:7,代码来源:StandardExecutor.cs
示例11: SetUp
public void SetUp()
{
_queue = MockRepository.GenerateStub<IBlockingQueue<IRunnable>>();
_runnable = MockRepository.GenerateMock<IRunnable>();
_discardOldestPolicy = new ThreadPoolExecutor.DiscardOldestPolicy();
_threadPoolExecutor = Mockery.GeneratePartialMock<ThreadPoolExecutor>(1, 1, TimeSpan.FromSeconds(1), _queue);
}
开发者ID:rlxrlxrlx,项目名称:spring-net-threading,代码行数:7,代码来源:DiscardOldestPolicyTest.cs
示例12: Queue
public override void Queue(IRunnable runnable)
{
using (RWLock.AsReader(_lock))
{
SelectQueue(_lock, _queues, runnable).Enqueue(runnable);
}
}
开发者ID:simonlaroche,项目名称:machine,代码行数:7,代码来源:QueuePerWorkerStrategy.cs
示例13: PostOnAnimation
public static void PostOnAnimation(View view, IRunnable runnable)
{
if ((int)Android.OS.Build.VERSION.SdkInt >= (int)Android.OS.Build.VERSION_CODES.JellyBean) {
PostOnAnimationJellyBean(view, runnable);
} else {
view.PostDelayed(runnable, SIXTY_FPS_INTERVAL);
}
}
开发者ID:Manne990,项目名称:PhotoViewerTest,代码行数:8,代码来源:Compat.cs
示例14: Execute
public void Execute(IRunnable command)
{
if (!this.IsAcceptingNewTasks)
{
throw new RejectedExecutionException();
}
this.Unwrap().Execute(command);
}
开发者ID:dalong123,项目名称:DotNetty,代码行数:8,代码来源:PausableChannelEventExecutor.cs
示例15: AssignExceptionHandler
/// <summary> Returns wrapped runnable that ensures that if an exception occurs
/// during the execution, the specified exception handler is invoked.
/// </summary>
/// <param name="runnable">runnable for which exceptions are to be intercepted
/// </param>
/// <param name="handler">the exception handler to call when exception occurs
/// during execution of the given runnable
/// </param>
/// <returns> wrapped runnable
/// </returns>
/// <exception cref="System.ArgumentNullException">If either parameter is <c>null</c></exception>
public static IRunnable AssignExceptionHandler(IRunnable runnable, UncaughtExceptionHandlerDelegate handler)
{
if ( runnable == null )
throw new ArgumentNullException("runnable", "Runnable cannot be null");
if ( handler == null )
throw new ArgumentNullException("handler", "Handler cannot be null");
return new AnonymousClassRunnable(runnable, handler);
}
开发者ID:Elders,项目名称:Ares,代码行数:19,代码来源:ThreadExceptionHandlerHelpers.cs
示例16: Execute
public override void Execute(IRunnable command)
{
if (command == null)
{
throw new NullReferenceException("command");
}
this.tasks.Enqueue(command);
}
开发者ID:nayato,项目名称:DotNetty,代码行数:8,代码来源:EmbeddedEventLoop.cs
示例17: Thread
Thread(IRunnable runnable, ThreadGroup grp, string name)
{
_thread = new System.Threading.Tasks.Task(InternalRun);
this._runnable = runnable ?? this;
_tgroup = grp ?? _defaultGroup;
_tgroup.Add (this);
}
开发者ID:istupakov,项目名称:SharpCifs,代码行数:8,代码来源:Thread.cs
示例18: RunRunnable
public static void RunRunnable(IRunnable runnable)
{
Thread thread = new Thread(runnable.Run);
thread.IsBackground = true;
thread.Priority = ThreadPriority.Lowest;
thread.Start();
}
开发者ID:BackupTheBerlios,项目名称:puzzle-svn,代码行数:8,代码来源:RunnableEngine.cs
示例19: TaskService
/// <summary>
/// Role Service Constructor
/// </summary>
/// <param name="run">Task Manager</param>
public TaskService(IRunnable run)
{
if (null == run)
{
throw new ArgumentNullException("run");
}
this.run = run;
}
开发者ID:jefking,项目名称:King.Service.ServiceFabric,代码行数:13,代码来源:TaskService.cs
示例20: ExecuteAfter
public static Thread ExecuteAfter(string threadName, long timeInMillis, IRunnable
runnable)
{
Thread t = new _Thread_96(timeInMillis, runnable);
t.SetName(threadName);
t.SetDaemon(true);
t.Start();
return t;
}
开发者ID:masroore,项目名称:db4o,代码行数:9,代码来源:PausableBlockingQueueTestCase.cs
注:本文中的IRunnable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论