Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4050604
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:05:25+00:00 2026-05-20T14:05:25+00:00

Summary : synchronisation of multiple SQLite databases with server side sequentially. I’m working on

  • 0

Summary: synchronisation of multiple SQLite databases with server side sequentially.

I’m working on an Android application that is bound to be modular: we have a launcher that fires off intents, based on user choice, to start different application modules (separate installable packages). As it is now, each module has its own SQLite database and that works fine. The task I’m assigned to requires making data synchronisation between handheld and server side (SQL Server 2008 R2) using MS Sync Framework 4.0 (currently October CTP). I had developed android lib according to Sync Framework specs and that works too.

The issue I have is that because of this loosely coupled design (and some other restrictions) I need to have a button in launcher, that forces all modules to synchronise their databases one-by-one (order doesn’t matter for now).

My current approach is to have an abstract BroadcastReceiver & Service (I only now discovered IntentService) classes that are inherited in each modules. So in launcher I broadcast intent, each module picks it up using customized BroadcastReceiver and syncs its database using, again, customized Service… In parallel. I have checked ordered broadcasts, but as I have a service doing the actual work it doesn’t really help. The only other way I can currently think of is to have a system-wide mutex and use it to lock sync call in every service.

This is my first Android related task so there probably is a better way to solve this, I wouldn’t run from redesigning synchronisation part if that makes our teams future life a bit easier.

[EDIT] So it looks like Java doesn’t support named mutexes.

[EDIT2] By modules (or separate installable packages) I meant different APK for each module. So when starting a module you actually start a new process for it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:05:26+00:00Added an answer on May 20, 2026 at 2:05 pm

    At the end I had to implement global lock using server socket like this:

    ServerSocket mServerSocket;
    
    /**
     * Simulates global locking using server socket
     * @return If lock was successful
     */
    private synchronized boolean lock() {
      try {
        Log.v(serviceName, "Trying to acquire a lock...");
        // any port from 49152 through 65535 should work
        mServerSocket = new ServerSocket(51515);
        return true;
      } catch (IOException ioe) {
        return false;
      }         
    }
    
    /**
     * Simulates global unlocking
     */
    private synchronized void unlock() {
      try {
        Log.v(serviceName, "Releasing a lock.");
        if (mServerSocket != null) {
          if (!mServerSocket.isClosed()) {
            mServerSocket.close();
          }
          mServerSocket = null;     
        }
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Summary We have an ASP.NET application that allows users to query a SQL Server
Summary: I'm developing a persistent Java web application, and I need to make sure
Summary: I have a struct that is read/written to file. This struct changes frequently,
Summary In my WPF application, I needed a TabControl with buttons on the left,
Summary I currently have a NAnt build script that performs a vssget on either
Summary I have a web-application with more than 5 themes. Each themes covers a
Summary: the Exception is telling me that the transaction is read-only; a debug println
Summary I want to run my cross-compiled application against the 10.5 libraries. Is there
Summary: How do I configure my facebook application to request additional information from the
Summary Hi All, OK, further into my adventures with custom controls... In summary, here

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.