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 4097128
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:08:02+00:00 2026-05-20T20:08:02+00:00

Im trying to do a Corba program implemented with java that is at the

  • 0

Im trying to do a Corba program implemented with java that is at the same time a server for another java program and a client for another , so i need a non blocking orb which can be run in a separate thread (i have it in my class Orb_run) :
but i have a problem when instanciating Orb_run , i have to provide an ORB object ,but if i call init method on the orb it will create a new bkocking object here’s my server’s code,

public class machine {                                                                         
static int uid = 1;               
etat_machine etat;
static ORB  orb;   
static int token_uid  = 1;                                                                                                        


static void server(String[] args, int uid, int token_uid){         
   try {        
    //Instanciate Orb obj
    //orb = ORB.init(args, null); 

    //Instancier Orb_run
    Orb_Run orb_run = new Orb_Run(orb);

    POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
    poa.the_POAManager().activate();    

    machineImpl machine = new machineImpl(poa, uid, jeton_uid);        

    // create the object reference
    org.omg.CORBA.Object mach = poa.servant_to_reference(machine);

    try {
            String m1_ref = orb.object_to_string(mach);
            String refFile = "m1.ref";
            PrintWriter out = new PrintWriter(new FileOutputStream(refFile));
            out.println(m1_ref);
            out.close();
            } 
        catch (IOException ex) {
                System.err.println(
                        "Impossible d'ecrire la reference dans m1.ref");
                System.exit(1);
            }

        System.out.println("Le serveur m1 est pret ");

        // wait for requests
        orb_run.run();

    System.exit(0);
    }
    catch (Exception e) {
        System.out.println(e);
    }    

  //Client
  public static int client(int token_uid){

    orb.init(); 
   // Orb_Run orb_run = new Orb_Run(orb);
     String ior = null;

        try {
            String ref = "m2.ref";
            FileInputStream file = new FileInputStream(ref);
            BufferedReader in = new BufferedReader(new InputStreamReader(file));
            ior = in.readLine();
            file.close();
        } catch (IOException ex) {
            System.err.println("Impossible de lire fichier : '" +
            ex.getMessage() + "'");
            System.exit(1);
        }


        org.omg.CORBA.Object obj = orb.string_to_object(ior);

        if (obj == null) {
            System.err.println("Erreur sur string_to_object() ");
            throw new RuntimeException();
        }

 machine machine = machineHelper.narrow(obj); 

        if (machine == null) {
            System.err.println("Erreur sur narrow() ");
            throw new RuntimeException();
        }


        System.out.println("avant appel traitement_message ");

        jeton_uid = machine.traitement_message();

        System.out.println("le uid ds le jeton mnt"+ jeton_uid);

        return jeton_uid;
    }

}

I’m starting a non-blocking orb in a seperate thread using this class:

 public class Orb_Run extends Thread {

    public ORB  orb_;

   public Orb_Run(ORB  o) {
       orb_=o;
   }                                             
   public void run() {
      System.out.println("Le serveur est pret");
      orb_.run();
   }    }                                                                                      }

So if you have some tips on how to do it , it will be great .

thanks.

  • 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-20T20:08:02+00:00Added an answer on May 20, 2026 at 8:08 pm

    I don’t know of any way to start a non-blocking ORB using the standard APIs in Java. Can you instead spawn a new thread to run the ORB, and then carry on working in the main thread? Or spawn worker threads for the client work, and use the main thread for the ORB?

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

Sidebar

Related Questions

Trying to find some simple SQL Server PIVOT examples. Most of the examples that
I'm trying to run a Java application I wrote to subscribe to a CORBA
I am writing a simulator for a CORBA client, that is I am simulating
Trying to setup an SSH server on Windows Server 2003. What are some good
Trying to make a make generic select control that I can dynamically add elements
Trying to perform a single boolean NOT operation, it appears that under MS SQL
Trying to honor a feature request from our customers, I'd like that my application,
I'm trying to add SSL to an existing CORBA app, and I keep getting
Have been pulled down into the realm of CORBA... I am trying to quickly
When im trying to resolve a CORBA reference I receive a segmentation fault. Either

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.