All Downloads are FREE. Search and download functionalities are using the official Maven repository.

system.threading.tasks.Task Maven / Gradle / Ivy

/*
 *  MIT License
 *
 *  Copyright (c) 2024 MASES s.r.l.
 *
 *  Permission is hereby granted, free of charge, to any person obtaining a copy
 *  of this software and associated documentation files (the "Software"), to deal
 *  in the Software without restriction, including without limitation the rights
 *  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *  copies of the Software, and to permit persons to whom the Software is
 *  furnished to do so, subject to the following conditions:
 *
 *  The above copyright notice and this permission notice shall be included in all
 *  copies or substantial portions of the Software.
 *
 *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 *  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 *  SOFTWARE.
 */

/**************************************************************************************
 * 
 *      This code was generated from a template using JCOReflector v. 1.15.0.0
 * 
 *      Manual changes to this file may cause unexpected behavior in your application.
 *      Manual changes to this file will be overwritten if the code is regenerated.
 * 
 *************************************************************************************/

package system.threading.tasks;

import org.mases.jcobridge.*;
import org.mases.jcobridge.netreflection.*;
import java.util.ArrayList;

// Import section
import system.Action;
import system.threading.CancellationToken;
import system.threading.tasks.TaskCreationOptions;
import system.TimeSpan;
import system.threading.tasks.Task;
import system.runtime.compilerservices.ConfiguredTaskAwaitable;
import system.threading.tasks.ConfigureAwaitOptions;
import system.runtime.compilerservices.TaskAwaiter;
import system.runtime.compilerservices.YieldAwaitable;
import system.TimeProvider;
import system.threading.tasks.TaskScheduler;
import system.AggregateException;
import system.threading.tasks.TaskFactory;
import system.threading.tasks.TaskStatus;


/**
 * The base .NET class managing System.Threading.Tasks.Task, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e.
 * 

* * .NET documentation at https://docs.microsoft.com/en-us/dotnet/api/System.Threading.Tasks.Task *

* * Powered by JCOBridge: more info at https://www.jcobridge.com * * @author MASES s.r.l https://masesgroup.com * @version 1.15.0.0 */ public class Task extends NetObject implements AutoCloseable { /** * Fully assembly qualified name: System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e */ public static final String assemblyFullName = "System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"; /** * Assembly name: System.Private.CoreLib */ public static final String assemblyShortName = "System.Private.CoreLib"; /** * Qualified class name: System.Threading.Tasks.Task */ public static final String className = "System.Threading.Tasks.Task"; static JCOBridge bridge = JCOBridgeInstance.getInstance(assemblyFullName); /** * The type managed from JCOBridge. See {@link JCType} */ public static JCType classType = createType(); static JCEnum enumInstance = null; JCObject classInstance = null; static JCType createType() { try { String classToCreate = className + ", " + (JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); if (JCOReflector.getDebug()) JCOReflector.writeLog("Creating %s", classToCreate); JCType typeCreated = bridge.GetType(classToCreate); if (JCOReflector.getDebug()) JCOReflector.writeLog("Created: %s", (typeCreated != null) ? typeCreated.toString() : "Returned null value"); return typeCreated; } catch (JCException e) { JCOReflector.writeLog(e); return null; } } void addReference(String ref) throws Throwable { try { bridge.AddReference(ref); } catch (JCNativeException jcne) { throw translateException(jcne); } } /** * Internal constructor. Use with caution */ public Task(java.lang.Object instance) throws Throwable { super(instance); if (instance instanceof JCObject) { classInstance = (JCObject) instance; } else throw new Exception("Cannot manage object, it is not a JCObject"); } public String getJCOAssemblyName() { return assemblyFullName; } public String getJCOClassName() { return className; } public String getJCOObjectName() { return className + ", " + (JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); } public java.lang.Object getJCOInstance() { return classInstance; } public void setJCOInstance(JCObject instance) { classInstance = instance; super.setJCOInstance(classInstance); } public JCType getJCOType() { return classType; } /** * Try to cast the {@link IJCOBridgeReflected} instance into {@link Task}, a cast assert is made to check if types are compatible. * @param from {@link IJCOBridgeReflected} instance to be casted * @return {@link Task} instance * @throws java.lang.Throwable in case of error during cast operation */ public static Task cast(IJCOBridgeReflected from) throws Throwable { NetType.AssertCast(classType, from); return new Task(from.getJCOInstance()); } // Constructors section public Task() throws Throwable { } public Task(Action action, CancellationToken cancellationToken, TaskCreationOptions creationOptions) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.ArgumentNullException, system.NullReferenceException { try { // add reference to assemblyName.dll file addReference(JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); setJCOInstance((JCObject)classType.NewObject(action, cancellationToken == null ? null : cancellationToken.getJCOInstance(), creationOptions == null ? null : creationOptions.getJCOInstance())); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Task(Action action, CancellationToken cancellationToken) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.ArgumentNullException, system.NullReferenceException { try { // add reference to assemblyName.dll file addReference(JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); setJCOInstance((JCObject)classType.NewObject(action, cancellationToken == null ? null : cancellationToken.getJCOInstance())); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Task(Action action, TaskCreationOptions creationOptions) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.ArgumentNullException, system.NullReferenceException { try { // add reference to assemblyName.dll file addReference(JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); setJCOInstance((JCObject)classType.NewObject(action, creationOptions == null ? null : creationOptions.getJCOInstance())); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Task(Action action) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.ArgumentNullException, system.NullReferenceException { try { // add reference to assemblyName.dll file addReference(JCOReflector.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName); setJCOInstance((JCObject)classType.NewObject(action)); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Methods section public boolean Wait(int millisecondsTimeout, CancellationToken cancellationToken) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.NotSupportedException, system.ObjectDisposedException, system.RankException, system.IndexOutOfRangeException, system.diagnostics.tracing.EventSourceException, system.threading.tasks.TaskSchedulerException, system.NullReferenceException, system.OperationCanceledException, system.OutOfMemoryException, system.FormatException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Invoke("Wait", millisecondsTimeout, cancellationToken == null ? null : cancellationToken.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean Wait(int millisecondsTimeout) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.threading.tasks.TaskSchedulerException, system.NullReferenceException, system.OperationCanceledException, system.FormatException, system.ArgumentNullException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Invoke("Wait", millisecondsTimeout); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean Wait(TimeSpan timeout, CancellationToken cancellationToken) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.NotSupportedException, system.ObjectDisposedException, system.RankException, system.IndexOutOfRangeException, system.OperationCanceledException, system.threading.tasks.TaskSchedulerException, system.NullReferenceException, system.FormatException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Invoke("Wait", timeout == null ? null : timeout.getJCOInstance(), cancellationToken == null ? null : cancellationToken.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean Wait(TimeSpan timeout) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.OperationCanceledException, system.threading.tasks.TaskSchedulerException, system.NullReferenceException, system.OutOfMemoryException, system.IndexOutOfRangeException, system.FormatException, system.ArgumentNullException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Invoke("Wait", timeout == null ? null : timeout.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static boolean WaitAll(Task[] tasks, int millisecondsTimeout, CancellationToken cancellationToken) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.NotSupportedException, system.ArgumentNullException, system.ObjectDisposedException, system.RankException, system.IndexOutOfRangeException, system.OperationCanceledException, system.threading.tasks.TaskSchedulerException, system.NullReferenceException, system.FormatException, system.AggregateException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { return (boolean)classType.Invoke("WaitAll", toObjectFromArray(tasks), millisecondsTimeout, cancellationToken == null ? null : cancellationToken.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static boolean WaitAll(Task[] tasks, int millisecondsTimeout) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.NotSupportedException, system.ArgumentNullException, system.ObjectDisposedException, system.RankException, system.IndexOutOfRangeException, system.OperationCanceledException, system.threading.tasks.TaskSchedulerException, system.NullReferenceException, system.FormatException, system.AggregateException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { return (boolean)classType.Invoke("WaitAll", toObjectFromArray(tasks), millisecondsTimeout); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static boolean WaitAll(Task[] tasks, TimeSpan timeout) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.NotSupportedException, system.ObjectDisposedException, system.RankException, system.IndexOutOfRangeException, system.OperationCanceledException, system.threading.tasks.TaskSchedulerException, system.NullReferenceException, system.FormatException, system.AggregateException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { return (boolean)classType.Invoke("WaitAll", toObjectFromArray(tasks), timeout == null ? null : timeout.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static int WaitAny(Task[] tasks, int millisecondsTimeout, CancellationToken cancellationToken) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.ArgumentNullException, system.OperationCanceledException, system.NullReferenceException, system.threading.tasks.TaskSchedulerException, system.OutOfMemoryException, system.FormatException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { return (int)classType.Invoke("WaitAny", toObjectFromArray(tasks), millisecondsTimeout, cancellationToken == null ? null : cancellationToken.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static int WaitAny(Task[] tasks, int millisecondsTimeout) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.ArgumentNullException, system.OperationCanceledException, system.NullReferenceException, system.threading.tasks.TaskSchedulerException, system.OutOfMemoryException, system.FormatException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { return (int)classType.Invoke("WaitAny", toObjectFromArray(tasks), millisecondsTimeout); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static int WaitAny(Task[] tasks, CancellationToken cancellationToken) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.ArgumentNullException, system.OperationCanceledException, system.NullReferenceException, system.threading.tasks.TaskSchedulerException, system.OutOfMemoryException, system.FormatException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { return (int)classType.Invoke("WaitAny", toObjectFromArray(tasks), cancellationToken == null ? null : cancellationToken.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static int WaitAny(Task[] tasks, TimeSpan timeout) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.NotSupportedException, system.ObjectDisposedException, system.RankException, system.IndexOutOfRangeException, system.OperationCanceledException, system.NullReferenceException, system.threading.tasks.TaskSchedulerException, system.OutOfMemoryException, system.FormatException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { return (int)classType.Invoke("WaitAny", toObjectFromArray(tasks), timeout == null ? null : timeout.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static int WaitAny(Task... tasks) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.ArgumentNullException, system.OperationCanceledException, system.NullReferenceException, system.threading.tasks.TaskSchedulerException, system.OutOfMemoryException, system.FormatException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { return (int)classType.Invoke("WaitAny", (java.lang.Object)toObjectFromArray(tasks)); } catch (JCNativeException jcne) { throw translateException(jcne); } } public ConfiguredTaskAwaitable ConfigureAwait(boolean continueOnCapturedContext) throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objConfigureAwait = (JCObject)classInstance.Invoke("ConfigureAwait", continueOnCapturedContext); return new ConfiguredTaskAwaitable(objConfigureAwait); } catch (JCNativeException jcne) { throw translateException(jcne); } } public ConfiguredTaskAwaitable ConfigureAwait(ConfigureAwaitOptions options) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.NotSupportedException, system.ObjectDisposedException, system.RankException, system.IndexOutOfRangeException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objConfigureAwait = (JCObject)classInstance.Invoke("ConfigureAwait", options == null ? null : options.getJCOInstance()); return new ConfiguredTaskAwaitable(objConfigureAwait); } catch (JCNativeException jcne) { throw translateException(jcne); } } public TaskAwaiter GetAwaiter() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objGetAwaiter = (JCObject)classInstance.Invoke("GetAwaiter"); return new TaskAwaiter(objGetAwaiter); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static YieldAwaitable Yield() throws Throwable { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objYield = (JCObject)classType.Invoke("Yield"); return new YieldAwaitable(objYield); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static Task Delay(int millisecondsDelay, CancellationToken cancellationToken) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.diagnostics.tracing.EventSourceException, system.IndexOutOfRangeException, system.NullReferenceException, system.threading.LockRecursionException, system.threading.AbandonedMutexException, system.OutOfMemoryException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objDelay = (JCObject)classType.Invoke("Delay", millisecondsDelay, cancellationToken == null ? null : cancellationToken.getJCOInstance()); return new Task(objDelay); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static Task Delay(int millisecondsDelay) throws Throwable, system.ArgumentException, system.NotSupportedException, system.InvalidOperationException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NullReferenceException, system.ArgumentNullException, system.threading.LockRecursionException, system.OutOfMemoryException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objDelay = (JCObject)classType.Invoke("Delay", millisecondsDelay); return new Task(objDelay); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static Task Delay(TimeSpan delay, CancellationToken cancellationToken) throws Throwable, system.ArgumentException, system.NotSupportedException, system.InvalidOperationException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.PlatformNotSupportedException, system.NullReferenceException, system.threading.LockRecursionException, system.OutOfMemoryException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objDelay = (JCObject)classType.Invoke("Delay", delay == null ? null : delay.getJCOInstance(), cancellationToken == null ? null : cancellationToken.getJCOInstance()); return new Task(objDelay); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static Task Delay(TimeSpan delay, TimeProvider timeProvider, CancellationToken cancellationToken) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.ArgumentNullException, system.diagnostics.tracing.EventSourceException, system.IndexOutOfRangeException, system.NullReferenceException, system.threading.LockRecursionException, system.threading.AbandonedMutexException, system.OutOfMemoryException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objDelay = (JCObject)classType.Invoke("Delay", delay == null ? null : delay.getJCOInstance(), timeProvider == null ? null : timeProvider.getJCOInstance(), cancellationToken == null ? null : cancellationToken.getJCOInstance()); return new Task(objDelay); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static Task Delay(TimeSpan delay, TimeProvider timeProvider) throws Throwable, system.ArgumentException, system.NotSupportedException, system.InvalidOperationException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.PlatformNotSupportedException, system.NullReferenceException, system.threading.LockRecursionException, system.OutOfMemoryException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objDelay = (JCObject)classType.Invoke("Delay", delay == null ? null : delay.getJCOInstance(), timeProvider == null ? null : timeProvider.getJCOInstance()); return new Task(objDelay); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static Task Delay(TimeSpan delay) throws Throwable, system.ArgumentException, system.NotSupportedException, system.InvalidOperationException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.PlatformNotSupportedException, system.NullReferenceException, system.threading.LockRecursionException, system.OutOfMemoryException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objDelay = (JCObject)classType.Invoke("Delay", delay == null ? null : delay.getJCOInstance()); return new Task(objDelay); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static Task FromCanceled(CancellationToken cancellationToken) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.NotSupportedException, system.ObjectDisposedException, system.RankException, system.IndexOutOfRangeException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objFromCanceled = (JCObject)classType.Invoke("FromCanceled", cancellationToken == null ? null : cancellationToken.getJCOInstance()); return new Task(objFromCanceled); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static Task FromException(NetException exception) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.NotSupportedException, system.ArgumentNullException, system.ObjectDisposedException, system.RankException, system.IndexOutOfRangeException, system.NullReferenceException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objFromException = (JCObject)classType.Invoke("FromException", exception == null ? null : exception.getJCOInstance()); return new Task(objFromException); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static Task Run(Action action, CancellationToken cancellationToken) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.ArgumentNullException, system.NullReferenceException, system.IndexOutOfRangeException, system.OutOfMemoryException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objRun = (JCObject)classType.Invoke("Run", action, cancellationToken == null ? null : cancellationToken.getJCOInstance()); return new Task(objRun); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static Task Run(Action action) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.ArgumentNullException, system.NullReferenceException, system.IndexOutOfRangeException, system.OutOfMemoryException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objRun = (JCObject)classType.Invoke("Run", action); return new Task(objRun); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Task WaitAsync(CancellationToken cancellationToken) throws Throwable, system.ArgumentException, system.NotSupportedException, system.InvalidOperationException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.PlatformNotSupportedException, system.NullReferenceException, system.threading.LockRecursionException, system.threading.AbandonedMutexException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objWaitAsync = (JCObject)classInstance.Invoke("WaitAsync", cancellationToken == null ? null : cancellationToken.getJCOInstance()); return new Task(objWaitAsync); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Task WaitAsync(TimeSpan timeout, CancellationToken cancellationToken) throws Throwable, system.ArgumentException, system.NotSupportedException, system.InvalidOperationException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.PlatformNotSupportedException, system.NullReferenceException, system.threading.LockRecursionException, system.threading.AbandonedMutexException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objWaitAsync = (JCObject)classInstance.Invoke("WaitAsync", timeout == null ? null : timeout.getJCOInstance(), cancellationToken == null ? null : cancellationToken.getJCOInstance()); return new Task(objWaitAsync); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Task WaitAsync(TimeSpan timeout, TimeProvider timeProvider, CancellationToken cancellationToken) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.ArgumentNullException, system.NullReferenceException, system.threading.LockRecursionException, system.threading.AbandonedMutexException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objWaitAsync = (JCObject)classInstance.Invoke("WaitAsync", timeout == null ? null : timeout.getJCOInstance(), timeProvider == null ? null : timeProvider.getJCOInstance(), cancellationToken == null ? null : cancellationToken.getJCOInstance()); return new Task(objWaitAsync); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Task WaitAsync(TimeSpan timeout, TimeProvider timeProvider) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.ArgumentNullException, system.NullReferenceException, system.threading.LockRecursionException, system.threading.AbandonedMutexException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objWaitAsync = (JCObject)classInstance.Invoke("WaitAsync", timeout == null ? null : timeout.getJCOInstance(), timeProvider == null ? null : timeProvider.getJCOInstance()); return new Task(objWaitAsync); } catch (JCNativeException jcne) { throw translateException(jcne); } } public Task WaitAsync(TimeSpan timeout) throws Throwable, system.ArgumentException, system.NotSupportedException, system.InvalidOperationException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.PlatformNotSupportedException, system.NullReferenceException, system.threading.LockRecursionException, system.threading.AbandonedMutexException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject objWaitAsync = (JCObject)classInstance.Invoke("WaitAsync", timeout == null ? null : timeout.getJCOInstance()); return new Task(objWaitAsync); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static Task WhenAll(Task... tasks) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.NotSupportedException, system.ArgumentNullException, system.ObjectDisposedException, system.RankException, system.IndexOutOfRangeException, system.diagnostics.tracing.EventSourceException, system.NullReferenceException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject objWhenAll = (JCObject)classType.Invoke("WhenAll", (java.lang.Object)toObjectFromArray(tasks)); return new Task(objWhenAll); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void Dispose() throws Throwable, system.ArgumentException, system.NotSupportedException, system.InvalidOperationException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Invoke("Dispose"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void RunSynchronously() throws Throwable, system.ArgumentException, system.NotSupportedException, system.InvalidOperationException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NullReferenceException, system.ArgumentNullException, system.IndexOutOfRangeException, system.OperationCanceledException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Invoke("RunSynchronously"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void RunSynchronously(TaskScheduler scheduler) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.NotSupportedException, system.ArgumentNullException, system.ObjectDisposedException, system.RankException, system.IndexOutOfRangeException, system.NullReferenceException, system.OperationCanceledException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Invoke("RunSynchronously", scheduler == null ? null : scheduler.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void Start() throws Throwable, system.ArgumentException, system.NotSupportedException, system.InvalidOperationException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.PlatformNotSupportedException, system.NullReferenceException, system.IndexOutOfRangeException, system.OutOfMemoryException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Invoke("Start"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void Start(TaskScheduler scheduler) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.NullReferenceException, system.IndexOutOfRangeException, system.diagnostics.tracing.EventSourceException, system.OutOfMemoryException, system.ArgumentNullException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Invoke("Start", scheduler == null ? null : scheduler.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void Wait() throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.threading.tasks.TaskSchedulerException, system.NullReferenceException, system.OperationCanceledException, system.FormatException, system.ArgumentNullException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Invoke("Wait"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void Wait(CancellationToken cancellationToken) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.threading.tasks.TaskSchedulerException, system.NullReferenceException, system.OperationCanceledException, system.FormatException, system.ArgumentNullException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Invoke("Wait", cancellationToken == null ? null : cancellationToken.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static void WaitAll(Task[] tasks, CancellationToken cancellationToken) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.NotSupportedException, system.ArgumentNullException, system.ObjectDisposedException, system.RankException, system.IndexOutOfRangeException, system.OperationCanceledException, system.threading.tasks.TaskSchedulerException, system.NullReferenceException, system.FormatException, system.AggregateException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { classType.Invoke("WaitAll", toObjectFromArray(tasks), cancellationToken == null ? null : cancellationToken.getJCOInstance()); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static void WaitAll(Task... tasks) throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.NotSupportedException, system.ArgumentNullException, system.ObjectDisposedException, system.RankException, system.IndexOutOfRangeException, system.OperationCanceledException, system.threading.tasks.TaskSchedulerException, system.NullReferenceException, system.FormatException, system.AggregateException { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { classType.Invoke("WaitAll", (java.lang.Object)toObjectFromArray(tasks)); } catch (JCNativeException jcne) { throw translateException(jcne); } } public void close() throws Exception { try { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { classInstance.Invoke("Dispose"); } catch (JCNativeException jcne) { throw translateException(jcne); } } catch (Throwable t) { throw new Exception(t); } } // Properties section public boolean getIsCanceled() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Get("IsCanceled"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean getIsCompleted() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Get("IsCompleted"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean getIsCompletedSuccessfully() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Get("IsCompletedSuccessfully"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public boolean getIsFaulted() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (boolean)classInstance.Get("IsFaulted"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public int getId() throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.PlatformNotSupportedException, system.NotSupportedException, system.ObjectDisposedException, system.InvalidOperationException, system.RankException, system.ArrayTypeMismatchException, system.OutOfMemoryException, system.diagnostics.tracing.EventSourceException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { return (int)classInstance.Get("Id"); } catch (JCNativeException jcne) { throw translateException(jcne); } } public AggregateException getException() throws Throwable, system.ArgumentException, system.ArgumentOutOfRangeException, system.ArgumentNullException, system.InvalidOperationException, system.PlatformNotSupportedException, system.ArrayTypeMismatchException, system.NotSupportedException, system.ObjectDisposedException, system.RankException, system.IndexOutOfRangeException, system.TypeLoadException, system.NullReferenceException, system.OutOfMemoryException, system.FormatException { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("Exception"); return new AggregateException(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public NetObject getAsyncState() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("AsyncState"); return new NetObject(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static Task getCompletedTask() throws Throwable { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject val = (JCObject)classType.Get("CompletedTask"); return new Task(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public TaskCreationOptions getCreationOptions() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("CreationOptions"); return new TaskCreationOptions(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public static TaskFactory getFactory() throws Throwable { if (classType == null) throw new UnsupportedOperationException("classType is null."); try { JCObject val = (JCObject)classType.Get("Factory"); return new TaskFactory(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } public TaskStatus getStatus() throws Throwable { if (classInstance == null) throw new UnsupportedOperationException("classInstance is null."); try { JCObject val = (JCObject)classInstance.Get("Status"); return new TaskStatus(val); } catch (JCNativeException jcne) { throw translateException(jcne); } } // Instance Events section }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy