Multithreading in MAF Application

I have a requirement where I need to generate multiple threads to perform different actions. Can you please tell me some documents or examples to achieve this?

Hello

you use Java threads for that. The only thing to know is that if you change data in a thread, you must call AdfmfJavaUtilities.flushDataChangeEvent () for the main thread to learn about changes to display in the user interface

http://docs.Oracle.com/middleware/mobile201/Mobile/API-ref/Oracle/adfmf/framework/API/AdfmfJavaUtilities.html

For example

public void doSomethingAsynch() {}

Runnable yourJob = new Runnable() {}

prepare the call

public void run() {}

1 call for something

2. response of the handle

If the data has been changed in the MAF, r UI example for the list

providerChangeSupport.fireProviderRefresh(")
refresh the user interface in the main thread

AdfmfJavaUtilities.flushDataChangeEvent ();

}

}

in your method, run the above code by using a separate thread. Note that if you have more than one task to run, you want to create several threads in the pool and reuse of the pool

ExecutorService executor = Executors.newFixedThreadPool (1);

Executor.Execute (yourJob);

Executor.Shutdown ();

}

See:

https://codelatte.WordPress.com/2013/11/09/a-simple-newfixedthreadpool-example/

http://tutorials.jenkov.com/Java-util-concurrent/executorservice.html

http://Baptiste-Wicht.com/posts/2010/09/Java-concurrency-part-7-eXecutors-and-thread-pools.html

Frank

Tags: Oracle Mobile

Similar Questions

  • MAF application timeout

    When a MAF application is started, then came out, have any control over how long it remains in the State suspended devices Android or iOS?

    I would like a way for my application to timeout suspended, so after 30 minutes, the CRG app is restarted if it is reactivated.

    I couldn't find a lot of documentation on how to make this work, if someone can give me some advice on how to achieve this or point me to the documentation that would be greatly appreciated!

    Thank you.

    Amey,

    It's the MAF forum not the forum of the ADF.

    To answer the question: there is no way for the application to stop. If will come down and stay there until the owner of the device comes to it or explicitly closed using the gesture of the device.

    Frank

  • Unable to debug the CSS and JS MAF Application - need help

    Hello

    I tried to debug my app as a result of this process. BU has had no success.

    http://www.Ateam-Oracle.com/debugging-MAF-applications-on-Android/


    Only able to find attached as #EMULATOR sdk emulator - 5554 under chrome://inspect/#devices.

    But did not find the HTML code under it.

    It is always empty, although the emulator displays the page of the app.

    Could if it you please let me know if I am missing something here.

    I started the

    C:\JDeveloper\mywork\ChromeDebugTest\deploy\Android1 > Bad start-server
    * demon does not. from now on port 5037 *.
    * the daemon started successfully *.

    and check USB dubbing checked into the emulator.

    I put the proxy also in the emulator.

    ___________________________________________________________________

    I get the log in the logcat as below.

    09-25 13:05:57.496: D/AndroidRuntime (1194): > > > > > > com.android.internal.os.RuntimeInit AndroidRuntime START < < < < < <

    09-25 13:05:57.506: D/AndroidRuntime (1194): CheckJNI is running

    09-25 13:05:57.570: D/dalvikvm (1194): attempt to load lib libjavacore.so 0 × 0

    09-25 13:05:57.576: D/dalvikvm (1194): added shared lib 0 × 0 libjavacore.so

    09-25 13:05:57.616: D/dalvikvm (1194): attempt to load lib libnativehelper.so 0 × 0

    09-25 13:05:57.616: D/dalvikvm (1194): added shared lib 0 × 0 libnativehelper.so

    09-25 13:05:57.836: D/WebViewTimersControl (745): onBrowserActivityPause

    09-25 13:05:57.836: D/WebViewTimersControl (745): suspension webview timers, view = com.android.browser.BrowserWebView {40cdc720 VFEDHVCL. F... ID 0, 0-480 762}

    09-25 13:05:58.646: D/AndroidRuntime (1194): call the main entrance com.android.commands.pm.Pm

    09-25 13:05:58.916: D/AndroidRuntime (1194): VM stop

    Need help to solve this problem

    Thank you
    Ajoie

    I think that the minimum version of the Android SDK for this to work is 4.4 + API level 19 +.

    CM.

  • How to import a jar in MAF application file.

    How to import a jar in MAF application file.

    You should be able to add the jar using the project-> libraries and classpath properties

    Note that the POT will need to be compiled with JDK 1.4 runs correctly as part of your application on the mobile device.

  • Is it possible to access an ADF of MAF application

    Hi all

    I just started to learn Oracle of the MAF.

    Is it possible to access an ADF application that has already been deployed on a CRG oracle weblogic Server?

    or do we need to recreate a similar request just scratching by using features of the MAF?

    Kindly help me with the different possibilities.

    Siva

    Make sure that you add the server hosting the ADF application to the white list of the servers that can use the app to the MAF.

    Oracle ADF 11 g, Oracle of the MAF and developer of Java/J2EE applications: display of Images of the remote server OracleMAF

    Also, make sure the ADF Faces app URL is accessible from the browser on the mobile device on which you run your application of the MAF.

  • Support for generics is not available for MAF application in 12 c

    Hi Experts,

    Version of the MAF: 2.0.1.1.41.141107.1200

    Env: Andriod emulator

    Today, I tried to add a generic syntax in my application, but I've had tell compiler error

    Error (29,21): generic drugs are not supported in - source 1.4; (use - source 5 or later to enable generics) jdeveloper 12 c

    I have a right-click on project ViewController CRG App and checked the properties of the project, I found in the section of the compiler that it supports JDK 1.4 only and that is the question that I was not able to compile the generic code.

    I am not able to understand, why in Jdev 12 c IDE it has not argued for the implementation of the MAF to use higher or more recent version of the JDK.

    How can I enable superior version of the JDK in Jev 12 c

    Please refer to the fi shooting sceen my Jdev 12 c,.

    MAF_Issue.png

    Kind regards

    Kiran.

    The current version of MAF 2.0.1.X supports Java ME CDC 1.4 and you can't change that.  The next upcoming version of MAF will support Java SE JDK 1.8 profile compact 2, consisting of many candy syntax added in all older versions of Java 1.4, including generics.

    CM.

  • MAF: Applications deployed on iOS Simulator are not visible

    Hello

    I use Jdeveloper 12.1.3 for the implementation of the MAF on MAC device. I used to use Jdev 11.1.2.4 with Xcode 5.1.1 and jdk 1.6. Now, after the release of the CRG, I uninstalled Jdev 11.1.2.4, jdk 1.6 and installed Jdev 12.1.3 and jdk 1.7. Open examples of good applications that created new application also. But when it is deployed to the iOS Simulator, it gets deployed successfully but in the Simulator, no icons appear for applications. Pointers please.

    Thank you

    Ajay

    Get this job now, it seems I have to unlock device iPhone of the retina (4 inches). However, previously I was using 64-bit one.

    Not sure why it is not deploy open Simulator.

    Thank you

    AJ

  • Unable to deploy the MAF application on the emulator or device in the last downloaded SDK

    Hello

    Jdev: 12.1.3

    I was working at the request of the MAF with old android SDK, which has been downloaded a few months back.

    I downloaded the latest SDK the android site form. But now the app is not deployed.

    It throws the below error:

    After a throwugh search blogs I have deployed the apk file directly on the device, but then the initial screen of Red Oracle load forever and I do not get the intended page.

    Please help me.

    [11: 08:52] Server Android Debug bridge closure...

    [11: 08:52] undeployment.

    [11: 08:52] - incomplete deployment.

    [11: 08:52] deployment failed due to one or more errors returned by "C:\Hari\Softwares\Android\android-sdk\platform-tools\adb".  What follows is a summary of the returned error:

    Failure [DELETE_FAILED_INTERNAL_ERROR]

    MAF 2.0.1.2.0 is not compatible Android 5 Lollipop (API 21).  You can leave installed in the SDK, but all 21 API also download API 19 and use instead.

    Lollipop support is coming in the next version of MAF due.

    CM.

  • Deploy Application MAF on Win7 Jdev approx. iOS device

    Hello

    As MAF is a hybrid of Mobile development platform.

    I'm looking to deploy an application of MAF to and jDeveloper Windows 7 on an iOS device environment?

    Is it possible or I need an iOS for this machine?

    If possible how?

    XCode is only used to compile your MAF application (that you developed in JDeveloper on Mac or Windows) in iOS code.

    Ditto for the Android SDK tools but this compliles he Code Android. But the Android SDK is available for Windows and Mac.

    So if you try to deploy on a device iOS a Windows based PC, it will fail because I can't find XCode.

    So basically, you only need a Mac for XCode (which is the equivalent of Android SDK for iOS) but as the Android SDK is also available on Mac, you can use a Mac to deploy your MAF for Android and iOS application.

  • Enable logging for application Oracle MAF

    Hello

    Currently, development of a MAF application and tests on Android Simulator. Of course, I would need to view the logs so that whenever an exception occurs, I would know what who and where is the error occurring. at the level of my own application, for example, if an error occurs in a bean class.

    Can someone point me in the right direction? very much appreciated.

    Kind regards

    Oracle Jdeveloper 12.1.3.0.0

    Framework of mobile app 2.0.1.1.41.141107.1200

    Oracle ADF Mobile 12.1.3.0.41.140521.1008

    Android SDK 4.2.2

    See if this helps:

    https://docs.Oracle.com/middleware/mobile201/mobile/develop/MAF-debug-test.htm

    https://blogs.Oracle.com/Shay/entry/adf_mobile_logging_on_android

  • Multithreading and interactions with instruments

    I have to start by saying that I'm not a great programmer. I build an instrument that requires a computer interface, and I learned how to program at the time of writing the program, for most documentation work (which means I have re-written program one half package of time I learned new things like how to define data structures and so on).

    My question is about multithreading - in my application, I use the GUI to write a series of instructions, and then I press a "Start button" which loads the instructions on a Board that interprets and outputs some call digital logic by the precisely. In addition, if specified, the button 'start' begins a task DAQmx that takes a trigger of my Board and acquires data. As these scans can take a long time, it is better for me to run in a separate thread. I also try to run an additional thread that queries the Board of Directors for its status - if it is running, waiting for a trigger or stop - and updates a control LED to reflect the State periodically. The problem I have is that programming function, the Board of Directors and the audit of the State function has some overlap, which I imagine is the reason why I'm the General Protection faults.  I read on the Thread hangs and Thread-Safe queues, but those who seem to be especially on the transmission of data between threads. Ideally I would be able to make sure that two threads do not call the same function at the same time - how would implement this?

    In addition, I don't know if it is a problem of the two threads calling the same function at the same time (I dunno if it of a problem or not), or if the problem is the fact that when I call these functions, they need to access the USB interface and there may be some sort of conflict between them.  I'm really hitting a wall here because I think that I don't have a solid understanding of the operation of allocation memory and battery function.

    Hi Paul, from your description, it seems very likely that you have problems with contemporary access to the same resource from multiple threads, which could explain the GPF you receive.

    Thread locks are a common way to handle such situations, because they can allow a single thread to protect it from another thread any access to the shared resource.

    Locks are used is:

    1 create a lock before you need to use it (possibly at the start of the program)

    2. when a thread needs to access the USB port to communicate with the instrument, it must call CmtGetLock to block access from other threads: If the lock is free, it is acquired by the threads. If it is already owned by another thread, the thread waits on the CmtGetLock until the bolt is free

    3. once a lock is finished using the shared resource, it must call CmtReleaseLock to permitt the access to the resource from other threads

    4. at the end of the program, destroy the lock

    If you do not want to stay frozen in CmtGetLock of a thread there is a function in the library if the lock is free or not, so that you can stay in a loop waiting for the lock to be free, but with the wire still alive and able to continue its work (still without access to the shared resource (, of course).

    It is crucial that acquired locks are always released, otherwise the other threads will be permanently excluded from access to the shared resource: this review is particularly important when adding threads management, because you must be sure to release locks acquired even errors, when a policy of the commune is to jump to a label inside the error handling function and it is possible that a lock is held acquired errors.

  • Download the ipa to itunesconnect defective after the upgrade to 2.2.1 MAF (ITMS-90474 ERROR: "Invalid Bundle.) iPad multitasking support requires these guidelines)

    Hello

    Everyone knows about this problem? It all started after the upgrade to 2.2.1 MAF. The application loader complains with the following message:

    ITMS-90474 ERROR: "Invalid Bundle. iPad multitasking support requires these guidelines: "UIInterfaceOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationPortrait and UIInterfaceOrientationLandscapeRight. Find "UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationLandscapeRight" in all «...» »

    A quick google search lead me to this link http://stackoverflow.com/questions/32559724/ipad-multitasking-support-requires-these-orientations. I'll try again, but I thought that maybe there is a solution that has the parameters of MAF.

    Kind regards

    Majdi Jaqaman

    Hello.

    I am happy that it has worked for you in the end. The CRG team will probably add an option setting somewhere in a later version of the MAF. They also suggested a more clean approach to deal with the issue than to change the XCode project template.

    First, create a file named plugin.xml and paste the following inside XML. I suggest you create the file in a central location, because it can be referenced by more than one app.

    
    
        maf-plugin-opt-out-multitaskingn
        Opt out of iOS multitasking on iOS 9
        
            
                
            
        
    
    

    Then just register the plugin in the MAF - application.xml. Things should look like this:

    Best regards

    Frédéric.

  • MAF - Disable recording of errors

    Hello, I have a MAF application in prod and I would like to know if there is anything that I could turn off logging for the version release.

    I put the debugging into 'false' in maf.properties.

    I don't want the app to create the log file myAPKName.txt.

    My logging.properties:

    # by default the newspaper using the ConsoleHandler

    . handlers = java.util.logging.ConsoleHandler

    # by default the newspaper to use the SimpleFormatter

    . formatter = java.util.logging.SimpleFormatter

    level of # default ConsoleHandler record to SEVERUS

    oracle.adfmf.util.logging.ConsoleHandler.level = SEVERE

    oracle.adfmf.util.logging.ConsoleHandler.formatter = oracle.adfmf.util.logging.PatternFormatter

    oracle.adfmf.util.logging.PatternFormatter.pattern=[%LEVEL% - LOGGER CLASS - % - % METHOD] MESSAGE %

    the recorder of framework to use only the ConsoleHandler of #configure adfmf

    oracle.adfmf.framework.useParentHandlers = false

    Oracle.adfmf.Framework.Handlers = Oracle.adfmf.util.Logging.ConsoleHandler

    Oracle.adfmf.Framework.Level = Severe

    #configure the application log to use only the ConsoleHandler adfmf

    oracle.adfmf.application.useParentHandlers = false

    Oracle.adfmf.application.Handlers = Oracle.adfmf.util.Logging.ConsoleHandler

    Oracle.adfmf.application.Level = Severe

    and my maf.properties

    # Debugging Java settings

    Java.Debug.Enabled = False

    # Specifies the value of the whole of the port to use when debugging

    Java.Debug.port = 8000

    # Debugging JavaScript settings

    JavaScript.Debug.Enabled = False

    # Settings for the memory default segment size

    # see http://docs.Oracle.com/JavaME/config/CDC/CDC-opt-impl/ojmeec/1.0/runtime/HTML/CVM.htm

    Java.CommandLine.argument =-Xms50M

    Java.CommandLine.argument =-Xmn25M

    Java.CommandLine.argument =-Xmx125M

    # Specifies the function that will trigger the activation of JavaScript debugging

    #javascript.debug.feature = featureId:port

    Thanks for your help!

    Hello

    try to add the following in the adf - config.xml:

    http://xmlns.Oracle.com/ADF/config/properties">

    Kind regards
    Ognjen

  • URL, Cordova, MAF JS API on the Login Page

    We have difficulties to use the framework for a simple use case.

    On our custom log in HTML page, we want to add an anchor linking to our public web server where new users can register online.  All of our application is secure, which means an external URL feature is not an acceptable approach.  We must be able to navigate from the login page, to the registration page and back without using an external URL feature.

    Our first approach was simple.  After you add our domain to the whitelist of applications, we added an anchor with the URL as the HREF link.  (We also tried invoking window.open and setting window.location.href with JS).  If we add a basic anchor to the login page, the display of web pages embedded MAF navigates to our registration page, but there is no Back/fact/Close button.  Users cannot return the liaison, which is unacceptable.

    Rejecting this option so we thought that using the plugin Cordova InAppBrowser would do a better job.

    We tried the initialization of the MAF JS API nothing helps.  The Oracle online documentation shows how to add references to javascript base.js to a custom page of springboard, which allows access to Cordova, Cordova plugins and the API of JS MAF.  This same code doesn't seem to work for a custom login HTML page.  The 'showpagecomplete' event does not fire, and while the structure of the object and the JS API methods are built (adf.mf.api, adf.mf.el, etc.), called methods never call reminders of success or error in what we spend.

    Without the MAF JS API, we cannot access Cordova or the InAppBrowser plugin.  We have tested this plugin on another page AMX, so that we know that it has been installed successfully.  He can do what we need, if we can call it from our login.html page.

    Are we barking the wrong tree?  How can we add a simple link from the log in page, while allowing users to close the loaded HTML page when you're done?

    ENVIRONMENT:

    JDeveloper 12.1.3.1.41

    MAF 2.1.1.0.41

    Xcode 6.2

    10.9.5 OSX

    Early 2011 Macbook Pro

    Post edited by: rsmith248 Miskeyed JDeveloper version number.

    Hello

    Have you considered showing your registration page server side in an iframe?

    It is a simple but powerful technique to remain in the web view of your MAF application with full control over navigation (back).

    Steven Davelaar,

    Oracle Mobile & Cloud A-team.

  • MAF: Addition of the Cordova.Dialogue Plugin "CDVNotifications".

    Hello Oracle Community:

    If I understand the MAF sta ck is no longer ships with the Cordova.Dialogues plugin called "CDVNotistories" (see previous Discussion Forum Thread HERE)


    That is why any programmatic attempt to popup a message using the container ADFMF to invokeContainerJavaScriptFunction using the navigator.notification.alert method will fail to run. 


    Use case: I need to display the confirmation that users are connected successfully.  Here's how I did it in the ADF Mobile.

    () AdfmfContainerUtilities.invokeContainerJavaScriptFunction

    "CustomLogin.phone", "navigator.notification.alert."

    (New Object() {"successful connection.."});



    ASK:

    Implementation of an IOS directories are the files .h & ".m" to place in If the .h, .js files ".m" are not in the right directory I can not 'Add' the plugin in JDev.


    Screen Shot 2015-07-15 at 2.31.58 PM.png



    I spent the time to research in the Oracle documentation on the subject.  Some of the links that I've referenced are:


    Links:

    YouTube Tuts

    Hi @,TreeStrepek,

    having the Dialogs Cordova Plugin working in the MAF 2.1.2 is trivial. Given that the MAF has full support for plugins to Cordova, it is very easy to integrate.

    You must follow the steps thees:

    1. Locate the source Cordova Plugin Dialogs: the source code is provided with the MAF extension. You can find it at [JDEVELOPER_HOME]/jdev/extensions/oracle.maf/CordovaPlugins

    2 source plugin copy of your MAF project: this step is optional.

    3. Add the plugin in "maf - application.xml": open the tab "Plugins". In "Additional Plugins", click on "+" button and navigate to the location of the source code of the plugin.

    Navigation.notification is now available to use. Now your code will work:

    () AdfmfContainerUtilities.invokeContainerJavaScriptFunction

    "CustomLogin.phone", "navigator.notification.alert."

    (New Object() {"successful connection.."});

Maybe you are looking for

  • No tengo sonido en mi dell optiplex 780 tengo wxp

    OLA me lla mo I have a dell optiplex 780 migue y lo muestra in el ordenador no audio rreproduce me pueden decir como instalo el driver of pc audio mid

  • PHOTOS IN THE PHOTO GALLERY

    HOW TO COPY PHOTOS IN THE PHOTO GALLERY ON A FLASH DRIVE?

  • Computer IS NOT a CD/DVD player, how do I download my photoshop?

    I just bought a HP Envy laptop, it is not a CD/DVD drive. I have Photoshop Elements 12 on CD, is any way to use my serial number and download it online?

  • Recovery automatic flash saving location

    HelloI work a lot with flash lately, just to small changes to gifs and this which not.When I don't save a flash file in a .fla file but it must open as not registeredAnd there is a (recovery) automatic save triggered in the system he saves the file s

  • Take a quiz

    After a learner has used the maximum attempts and has not RAS is the best way to let them resume training early on, that would give them more chances to resume the quiz from scratch?