JBM2015
asked on
How to modify my class to be multi-threaded instead of Static?
This is my interface class:
public partial class POptions : object, System.Runtime.Serializati on.IExtens ibleDataOb ject
private static Interfaces.Entities.POptio ns _POptions = new Interfaces.Entities.Option s();
The UI class declares this way:
pOptions = pForm.Variables["POption"] as Interfaces.Entities.POptio ns;
The situation is we need to make this multithreaded so multiple requests can be queued and processed when the previous request has completed (or failed).
I've been looking at ConcurrentDictionary and ConcurrentQueueu, but not sure if they are the best tools for this job or not.
Please let me know your advice.
Thanks
public partial class POptions : object, System.Runtime.Serializati
private static Interfaces.Entities.POptio
The UI class declares this way:
pOptions = pForm.Variables["POption"]
The situation is we need to make this multithreaded so multiple requests can be queued and processed when the previous request has completed (or failed).
I've been looking at ConcurrentDictionary and ConcurrentQueueu, but not sure if they are the best tools for this job or not.
Please let me know your advice.
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Figured it out on my own.
ASKER
Thanks for the feedback, my solution may not need to be that complex. I'm thinking if I can get this object to use a ConcurrentDictionary, that would get me where I need to go.
Current:
private static Interfaces.Entities.POptio
Proposed:
private static ConcurrentDictionary<Guid,
In testing this Concurrent dictionary, it's not recognizing the data member of the POptions class, so I think my declaration is incorrect.
This is a snippet from the POptions class:
namespace Interfaces.Entities
{
public partial class POptions : object, System.Runtime.Serializati
{
private System.Runtime.Serializati
private Guid _newGuid;
public System.Runtime.Serializati
{
get
{
return this.extensionDataField;
}
set
{
this.extensionDataField = value;
}
}
[DataMember]
public bool IsProcessing
{
get { return _isProcessing; }
set { _isProcessing = value; }
}
[DataMember]
public Guid newGuid
{
get { return _newGuid; }
set { _newGuid = value; }
}
}
}
Thanks