synchronization

Help with a quick and dirty DB sync solution

Hello everyone, I have a problem with a deadline. And that deadline is tomorrow :S Luckily it doesn't have to be the best solution; not even a good one. I only need one part working which I will describe shortly. What I want you to know is that I looking for the quickest and dirtiest solution right so my idea maybe sound really bad. So,...

What is a good way to test that a Java method is synchronized?

I have several classes that implement some interface. The interface has a contract, that some methods should be synchronized, and some should not, and I want to verify that contract through unit tests for all the implementations. The methods should use the synchronized keyword or be locked on this - very similar to the synchronizedColl...

REST best practice: synchronizing a client to a server

I have a REST server and a client application running on a mobile device. The client has some data and would like to get updates to the data from the server. How do I do this in a RESTful way in a single transaction? Suppose the client has the following items: widget id=1 timestamp=2010-03-05T08:00:00 doodad id=1 widget=1 timest...

Is Java ArrayList / String / atomic variable reading thread safe?

Hi all, I've been mulling this over & reading but can find an absolute authoritative answer. I have several deep data structures made up of objects containing ArrayLists, Strings & primitive values. I can guarantee that the data in these structures will not change (no thread will ever make structural changes to lists, change references...

Where do I find a good .NET library for synchronise files over FTP, HTTP and SMB

I need a .NET library to synchronise files from a server to a client (one way). Requirements: Should be a .NET library Needs to be deployed via ClickOnce (that is, no instalation, no COM etc.) Needs to support HTTP and/or FTP and/or SMB Open Source, Free or Commercial ...

Operating system, Semaphores

Ferryboats go back and forth, carrying passengers from one side of the canal to the other. Each boat can hold at most C passengers. The passengers wait for the boats to ferry them across the canal. A boat can start crossing the river only when it is full. A boat cannot start loading passengers on one side of the canal if another boat is ...

increment a count value outside parallel.foreach scope

How can I increment an integer value outside the scope of a parallel.foreach loop? What's is the lightest way to synchronize access to objects outside parallel loops? var count = 0; Parallel.ForEach(collection, item => { action(item); // increment count?? } ...

What is a class monitor in D?

D2.0 classes have a __monitor class property that "gives access to the class object's monitor" (documentation). I searched around a bit and did not find any information except for this bit of detail. So: what is a monitor? Why is one monitor used for all synchronized member functions? Is it a synchronization primitive used for synchroni...

Unsynchronized getter/setter behavior in Java

I have a class that serves as a delegate to another. public class Delegate { private AnotherClass ac; public void delegateCall() { this.ac.actualCall(); } public void setAC(AnotherClass ac) { this.ac = ac; } } What are the ramifications if I have lots of threads calling delegateCall() and another...

Equivalent of PostMessage in C# to synchronize with the main thread with MVVM?

I must be retarded with searching, because here's another seemingly common problem that I haven't been able to solve. Here's my problem -- I am using WPF and MVVM, and I have a statemachine that executes in the model. If an error occurs, I need to pass information up to the ViewModel to display the error. This part seems to work okay....

Table-level diff and sync procedure for T-SQL

I'm interested in T-SQL source code for synchronizing a table (or perhaps a subset of it) with data from another similar table. The two tables could contain any variables, for example I could have base table source table ========== ============ id val id val ---------- ------------ 0 1 0 3 ...

How to keep client side cache in sync ?

I have a SQL server and couple Windows clients and cache of some tables as objects on clients. I currently have a pull mechanism where every one minute or so clients query one row in DB to understand if cache is still good if changed they sync everything, but I want to change this mechanism to push based. I mean I want server to “ping” ...

Can SynchronizationContext.Post or .Send lead to exceptions?

Hi I've read all recommended articles on SynchronizationContext, but there is one small question I did not find an answer for. In my case I have an event handler that calls a Log() method that outputs text to a TextBox. Log() is called from a WCF service. The event is raised from WCF client instances (threads). Usually, I check Control.I...

Synchronizing a collection of wrapped objects with a collection of unwrapped objects

I have two classes: Employee and EmployeeGridViewAdapter. Employee is composed of several complex types. EmployeeGridViewAdapter wraps a single Employee and exposes its members as a flattened set of system types so a DataGridView can handle displaying, editing, etc. I'm using VS's builtin support for turning a POCO into a data source, w...

Is there a better way to throttle a high throughput job?

I created a simple class that shows what I am trying to do without any noise. Feel free to bash away at my code. That's why I posted it here. public class Throttled : IDisposable { private readonly Action work; private readonly Func<bool> stop; private readonly ManualResetEvent continueProcessing; private readonly Timer ...

Will this make the object thread-safe?

I have a native Visual C++ COM object and I need to make it completely thread-safe to be able to legally mark it as "free-threaded" in th system registry. Specifically I need to make sure that no more than one thread ever accesses any member variable of the object simultaneously. The catch is I'm almost sure that no sane consumer of my ...

Many producer, single consumer with python/mod_wsgi

I have a Pylons web application served by Apache (mod_wsgi, prefork). Because of Apache, there are multiple separate processes running my application code concurrently. Some of the non-critical tasks that the application does I want to defer for processing in background to improve "live" response times. So I'm thinking of task queue, man...

How and where to store user uploaded files in high traffic web farm scenario website?

i am working on a website which deploy on web farms to serve high traffic. where should i store user uploaded files? is it wise to store uploaded files in the file system of the same website and synchronize these files in all web servers(web farm)? or should i use another server to store all uploaded files in this server to store files i...

Can Capistrano only move new files?

This is not a ruby/rails project deploy. I have the following situation and I would like to know if Capistrano can solve my problem, or if you know something more proper. A host Windows machine, with ruby installed and capistrano. This machine have some files in a folder, that will be updated (all or just some). The goal is to sync the...

How to check how many threads are waiting for a synchronized method to become unlocked

Is there any way to check how many threads are waiting for a synchronized method to become unlocked? I would like to know when the thread calls a synchronized method: 1) How many threads are already waiting to call the method? 2) Once the method is called how long it needed to wait for the method to become unlocked? Solution: I sol...