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

  • SEARCH
  • Home
  • 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 36379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:23:02+00:00 2026-05-10T14:23:02+00:00

I have a question on the best way of exposing an asynchronous remote interface.

  • 0

I have a question on the best way of exposing an asynchronous remote interface.

The conditions are as follows:

  • The protocol is asynchronous
  • A third party can modify the data at any time
  • The command round-trip can be significant
  • The model should be well suited for UI interaction
  • The protocol supports queries over certain objects, and so must the model

As a means of improving my lacking skills in this area (and brush up my Java in general), I have started a project to create an Eclipse-based front-end for xmms2 (described below).

So, the question is; how should I expose the remote interface as a neat data model (In this case, track management and event handling)?

I welcome anything from generic discussions to pattern name-dropping or concrete examples and patches 🙂


My primary goal here is learning about this class of problems in general. If my project can gain from it, fine, but I present it strictly to have something to start a discussion around.

I’ve implemented a protocol abstraction which I call ‘client’ (for legacy reasons) which allows me to access most exposed features using method calls which I am happy with even if it’s far from perfect.

The features provided by the xmms2 daemon are things like track searching, meta-data retrieval and manipulation, change playback state, load playlists and so on and so forth.

I’m in the middle of updating to the latest stable release of xmms2, and I figured I might as well fix some of the glaring weaknesses of my current implementation.

My plan is to build a better abstraction on top of the protocol interface, one that allows a more natural interaction with the daemon. The current ‘model’ implementation is hard to use and is frankly quite ugly (not to mention the UI-code which is truly horrible atm).

Today I have the Tracks interface which I can use to get instances of Track classes based on their id. Searching is performed through the Collections interface (unfortunate namespace clash) which I’d rather move to Tracks, I think.

Any data can be modified by a third party at any time, and this should be properly reflected in the model and change-notifications distributed

These interfaces are exposed when connecting, by returning an object hierarchy that looks like this:

  • Connection
    • Playback getPlayback()
      • Play, pause, jump, current track etc
      • Expose playback state changes
    • Tracks getTracks()
      • Track getTrack(id) etc
      • Expose track updates
    • Collections getCollection()
      • Load and manipulate playlists or named collections
      • Query media library
      • Expose collection updates
  • 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. 2026-05-10T14:23:02+00:00Added an answer on May 10, 2026 at 2:23 pm

    For the asynchronous bit, I would suggest checking into java.util.concurrent, and especially the Future<T> interface. The future interface is used to represent objects which are not ready yet, but are being created in a separate thread. You say that objects can be modified at any time by a third party, but I would still suggest you use immutable return objects here, and instead have a separate thread/event log you can subscribe to to get noticed when objects expire. I have little programming with UIs, but I believe using Futures for asynchronous calls would let you have a responsive GUI, rather than one that was waiting for a server reply.

    For the queries I would suggest using method chaining to build the query object, and each object returned by method chaining should be Iterable. Similar to how Djangos model is. Say you have QuerySet which implements Iterable<Song>. You can then call allSongs() which would return a result iterating over all Songs. Or allSongs().artist('Beatles'), and you would have an iterable over all Betles songs. Or even allSongs().artist('Beatles').years(1965,1967) and so on.

    Hope this helps as a starting place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 134k
  • Answers 134k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer How about using sockets, but with the help of asyncore… May 12, 2026 at 6:48 am
  • Editorial Team
    Editorial Team added an answer When you decrypt, you can create one array for your… May 12, 2026 at 6:48 am
  • Editorial Team
    Editorial Team added an answer If your "custom stream" isn't something you can represent with… May 12, 2026 at 6:48 am

Related Questions

I have a Silverlight application that communications with an ASP.NET backend through WCF. I
I have a rather large (80k loc) java desktop app that talks to a
I have a situation in C# where I have a list of simple types.
As I try to modernize my C++ skills, I keep encountering this situation where

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.