Pattern Singleton MAF 2.2.0

Hello

I have a change in behavior after upgrade to 2.2.0 MAF. I'm not sure if this is intentional or a bug. For me, looks like a bug because it is at odds with the singleton design pattern and behavior change does occur when the application is disabled, and then press it again.

Basically, I have a class in the ApplicationController which has been implemented in the singleton design pattern. The instance of this class (singleton) behaves as a singleton and is used by all the features. So MAF 2.1.3 which has worked. As MAF 2.2.0 instance behaves as a singleton until the application is disabled and then press it again.

Here's the scenario:

(1) start the application = > the singleton is created

(2) go to any device = > the singleton is always the same instance.

(3) turn off the app

(4) to activate the soft

(5) the original instance (singleton) is always available in the ApplicationLifeCycleListenerImpl as we like the functionality of the application in when he was disabled and enabled

(6) go to any other feature = > now I have a new instance of the class that implements the singleton pattern (I did several instances)

Everyone knows anything of this kind? I'm running on iOS.

Kind regards

Majdi Jaqaman

Hello

This has been fixed in 2.2.1 MAF.

Kind regards

Majdi Jaqaman

Tags: Oracle Mobile

Similar Questions

  • Global var

    IN AS3, I want to use GLobal variables (not much) that can be consulted in any class and a place where the fla or any file as reported can be used and be ale to change the value of them anywhere.

    I can do this in AS3?

    One of the ways is to create a class with static properties methods and access them from anywhere in your application. It is called pattern Singleton (in a way).

    For example:

    package {     public class DataProvider     {          public static var property1:String = "blah";          public function DataProvider() {
    
              }
    
              public static function staticMethod():int {               return 45;          }     }
    
    }
    

    Use (from anywhere in your application):

    trace (DataProvider.property1); bla

    DataProvider.property1 = "aha."

    trace (DataProvider.property1); AHA

    trace (DataProvider.staticMethod); 45

  • Singleton Pattern problem

    I try to be a good ActionScripter OO using the Singleton to have the control panel for an application.
    Here is the code and it works fine:


    the package com.gh {}

    [Bindable]
    public class SystemVars {}

    private static var _instance:SystemVars;
    private var _serverIP:String = "10.0.0.228";
    private var _serverPort:int = 7700;

    public void SystemVars (be: SingletonEnforcer): void {}
    }

    Public Shared function getInstance (): {SystemVars}
    If (!.) SystemVars._instance) {}
    SystemVars._instance = new SystemVars (new SingletonEnforcer());
    }
    Return SystemVars._instance;
    }

    public function get Ip_serveur (): String {}
    Return _serverIP;
    }

    public function set Ip_serveur (serverIP:String): void {}
    _serverIP = serverIP;
    }

    public function get serverPort (): int {}
    Return _serverPort;
    }

    public function set serverPort (serverPort:int): void {}
    _serverPort = serverPort;
    }
    }
    }

    Class SingletonEnforcer {}
    public void SingletonEnforcer (): void {}
    return;
    }
    }


    The problem comes when I want to use the Singleton Pattern have variables defined in a database using a HTTPService:


    the package com.gh {}
    Import mx.rpc.http.HTTPService;
    Import mx.rpc.events.ResultEvent;


    [Bindable]
    public class SystemVars {}

    private static var _instance:SystemVars;
    private var _serverIP:String;
    private var _serverPort:int;
    private var _httpService:HTTPService;

    public void SystemVars (be: SingletonEnforcer): void {}
    }

    Public Shared function getInstance (): {SystemVars}
    If (!.) SystemVars._instance) {}
    SystemVars._instance = new SystemVars (new SingletonEnforcer());
    SystemVars._instance.setVars ();
    }
    Return SystemVars._instance;
    }

    public function get Ip_serveur (): String {}
    Return _serverIP;
    }

    public function set Ip_serveur (serverIP:String): void {}
    _serverIP = serverIP;
    }

    public function get serverPort (): int {}
    Return _serverPort;
    }

    public function set serverPort (serverPort:int): void {}
    _serverPort = serverPort;
    }

    private function setVars (): void {}
    _httpService = new HTTPService();
    _httpService.URL = "" http://10.0.0.228/data/system_vars.php "; "
    _httpService.ResultFormat = HTTPService.RESULT_FORMAT_E4X;
    _httpService.addEventListener (ResultEvent.RESULT, httpServiceResultHandler);
    _httpService.send ();
    }

    private function httpServiceResultHandler (event: ResultEvent): void {}
    _serverIP = string (event.result.serverIP);
    _serverPort = int (event.result.serverPort);
    }

    }
    }

    Class SingletonEnforcer {}
    public void SingletonEnforcer (): void {}
    return;
    }
    }


    This works very well, with the exception of the values are null until the HTTPService returns a result.
    What I want to do, do not return the instance until there is a result, it's is it still possible?

    Or do I have to use a different approach?

    Analysis of Tracy to the situation above is accurate.

    Well that isn't ideal, a way to handle this would be to use a reminder. Basically, instead of returning a reference to your singleton directly, need you a reminder that expects a single argument, which will be a reference to your singleton. If the service is already back with the results, you simply call this callback immediately. Otherwise, you add to a table (since getInstance can be called several times before the service returned), then you call these reminders in your service result handler. Below are the changes you would make to your code:

    private var _callbacks:Array = [];

    public static void getInstance(onInit:Function):void {}
    If (!.) SystemVars._instance) {}
    SystemVars._instance = new SystemVars (new SingletonEnforcer());
    SystemVars._instance.setVars ();
    }
    of other if(!_serverIP) / / we are still waiting on a result
    _callbacks.push (OnInit);
    on the other
    onInit (SystemVars._instance);
    }

    private function httpServiceResultHandler (event: ResultEvent): void {}
    _serverIP = string (event.result.serverIP);
    _serverPort = int (event.result.serverPort);

    for (var i: int = 0; i< _callbacks.length;="" i++)="">
    var fn:Function = _callbacks ;
    FN (this);
    }

    _callbacks = null; We're done with it, so the memory
    }

  • Using the Singleton Pattern to keep the values of the previous variables?

    Is it possible using ExtendScript to retain the previous property, same value once it has been updated by the user? I know after effects update images expressions, but I believe that the values of script must be able to persist. This kind of thing is possible with ExtendScript?

    I think something like this should be achievable using a singleton as a model, but so far I've succumbed. Here's what I've tried so far:

    instance of the var;

    Check the value of the current instance

    Alert (GetInstance () .value);

    Check if the instance has a value, if this is not the case assign one, otherwise return the current value

    function getInstance() {}

    {if(!instance)}

    instance = createInstance();

    }

    return instance;

    } //End getInstance

    Create the new object with a value and return it

    function createInstance() {}

    var object = new Object (mySel.property("Effects") ("Transform") .property .property (1));

    Returns the object;

    } //End createInstance

    Or, if singletons are the wrong approach is there any type of storage mechanism that can be called in ExtendScript to write values?

    Thank you!

    I don't know (which means no there are not), but maybe your problem could be simplified.

    Your best chance would be to want to want to know if the property is changed at all, in which case you can use p.isModified.

    But if you want to know if it has been modified since the last change, then its a different story. Properties objects cannot be instantiated on their own, they are related to the actual properties in layers and cannot be "frozen".

    Brutal way:

    If the property is suspected of having a set of keys, you would be better of caching the stream of values in a table;

    Otherwise be cached keys (still many things to do... times, values, tweens) and the expression, but then comparing two States can be uncomfortable.

    .. for every p in your effect.

    I hope that you will get a better answer

    Xavier.

  • SIngleton and BlackBerry - need help

    Hi all

    I was wondering:

    If I want to make sure only one instance of my application is running - should I use the Singleton Pattern or not only the operating system of BB takes care of this?

    If I start the emulator once it, be it downloaded whenever I'll re - compile and rerun? (I mean the first round)

    My application is a PhoneListener application with a GUI, nothing complicated.

    Thank you!

    Not sure I understand the question.

    When you run the emulator, your application is is started during the boot process (if you have set the option to auto-start your project), or it is not. Each restart of the Simulator is basically the same as the device to start.

    If you do not have the autostart property set, then your application starts when you click the icon. If you exit the application and click on the new icon, your application is restarted.

    You can keep your application running in the background you override the close() method in your top-level window and perform a "requestbackground()". Then your application is reinstated through the method "activate()' rather than being rebooted.

    All this is covered faily well in the development of RIM software guide and the sample applications provided with the JDE.

  • Approach to singleton for screens

    Hello

    I would like to know if it is advisable to use a singleton pattern when you push the screen on the stack.

    For example:

    package com.xyz.mobile;

    Import net.rim.device.api.ui.container.MainScreen;

    SerializableAttribute public class EntryScreen extends form {}

    Private Shared EntryScreen thisInstance = null;
       
    private EntryScreen() {}
    Super();
    TODO initialize the fields here
    }
       
    public static getInstance() {} EntryScreen
    {if(thisInstance==null)}
    thisInstance = new EntryScreen();
    }
    Return thisInstance;
    }
       
    }

    Now in my application UI I would call:

    pushScreen (EntryScreen.getInstance ());

    The advantage I see is I would not re - initialize my fields whenever I want to push the EntryScreen in the stack. Is this recommended practice. ? Kindly guide me with this.

    Thanking you,

    Kind regards

    S.A.Norton Stanley

    If you have a reference to the screen, it will not change.

    You can do
    YourScreen yourScreen = new YourScreen();
    pushScreen (yourScreen);
    popScreen (yourScreen);
    pushScreen (yourScreen);
    etc.

  • 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

  • [MAF - AMPA] Strange behavior of the MAF with REST service

    Hi MAF Experts.

    I just noticed that there is a strange behavior in my application of the MAF. The first loading of the page, amx:page does not make its contents (of REST). However if I kill the app and relaunch the app, content appears.

    Pattern:

    1. Start of the CRG App
    2. Opening of session
    3. Dashboard (the content is rendered)
    4. Go to any other aspect (lets say a list of products)
    5. Open product list (content do not get returned)
    6. Kill the MAF application
    7. Start of the CRG App
    8. Dashboard (the content is rendered)
    9. Go to the product list
    10. List of products (content gets rendered)

    I put a few breakpoints on EntityCRUDService and RestPersistenceManager.

    So far it return the list of entities and display the correct data (from watches in debug mode)

    Last thing I noticed is the red color below. She defined the EntityList with the new value of REST (This displays a correct value).

    TaskExecutor.getInstance (.execute (isDoRemoteReadInBackground ())

    , () -> {

    Auto Sync all actions pending first, pass false for inBackground because

    We want to process actions pending before the reading distance

    getDataSynchManager (.synchronize (false));

    The list of entities < E > = executeRemoteFindAll();

    If (entities! = null)

    {

    When an error occurs (for example server is not available, the method returns the value zero)

    setEntityList (entities);

    }

    });

    Any suggestion?

    All the rest service are configured with AutoQuery = true in the persistence - mapping.xml

    See you soon,.

    Hendry

    Hendry,

    Thanks your testcase, I was able to understand the problem.

    It turns out that MAF 2.1 has problems dealing with the advanced way in which AMPA running background tasks with the help of a thread in all of features.

    We have slightly modified the implementation in AMPA to use one thread per function and now the update issue is resolved. I sent you a link to new construction.

    We will publish the new generation soon on GitHub so that others can benefit in the same solution.

    Steven Davelaar,

    Oracle Mobile A-team.

  • Singleton vs normal/global variable

    Hi just been looking intot he singleton pattern. WHY should I use this template to contain the variables accessible to other sovereign wealth funds throughout the project when I can just keep in the film container and access as you wish.

    Is there an advantage as optimization, security, usability etc...

    I'll post a question re: how to access a varibale in a mc parent except if answered here too as it is in the same category.

    It is better to go to a varibale in the parent uses

    1 MovieClip (parent.parent) .variableTargeted

    OR

    import com.parentAsDocument;

    Then navigate to the variable

    Thanks in advance

    (btw. I've never seen this in tutorials anywhere - and I've read for years - I missing something here or is - something advanced programmers don't know because they read advanced books?)

    If I need to use global variables - I'll probably use public static properties (variables) and methods in a special class that is designed to provide the values of these variables (or the features of the static methods) for the entire application. Any object making the reference to this class will be able to read/write these values.

    You are already familiar with static properties. For example when you add event listeners you write:

    mc.addEventListener (Event.ENTER_FRAME, handler);

    ENTER_FRAME is a static variable (and also a constant) which is accessible to ANY other object in the application around the WORLD.

    On the issue of container, I think you're talking about higher-level (timeline or document class) code. If my impressions are correct - no, I would never declare static properties or methods for the use of the application to scale. As I said, I would create a class special and this feature delegation to the and then tap other classes if necessary top.

    Frankly, I would never use timeline for anything unless someone puts a gun against my head (or hands a lot of money). In fact I avoid using IDE Flash quite like a plague. I mean that for one purpose - timeline coding is treacherous (and, oddly, more complicated than the use of the class) and encourage people is not to think of OBJECT-oriented way. The main disadvantage is that developers often assume that the chronology provides a kind of guarantees and the decorum and thus developers spend hurt little time thinking about the architecture of application in a more abstract way.

    I highly suggest if you consider excel programming skills to give up the chronology of coding as soon as possible (including the use of the Flash altogether) and move toward Flash Builder or any other environment. Benefits are awsome and you will never want to go back to the timeline.

    If you want to me - I'll give you a more concrete example of how I would approach implementation of the static aspects of the classes.

  • Cairngorm makes too rely on / promote Singletons?

    It seems to me that Cairngorm too promotes the use of Singleton classes for application development, which can cause serious headaches down the road.

    Two of their main design patterns are the CairngormEventDispatcher/CairgormEvent and the ModelLocator, as well as the FrontController. I came across a number of cases where the original design of an application was assumed to be independent, when in fact a little forethought would have made it clear that, ultimately, it is a built-in custom component more than anything else. Be able to use autonomous was useful, but in general it would be integrated as a module into another Flex application.

    The problem comes when you need to add a second instance of the Cairngorm application. I have a widget creation and a reading widget, both built from code shared since the creation widget also includes the reading widget. So now I want to integrate the TWO creating a widget AND a widget of reading in my application. Indeed, like any other component (think combobox), I might want to include several widgets reading, each showing some users personal creation, all on the same page.

    However, because my reading widget using Cairngorm, I'm practically no chance with the current code base. Assuming that I cram several widgets reading in a certain way (after all the question of departure/FrontController service) I have no way to control which of my multiple widgets responds when I hit the play button in one of them, because they are all listening for this event. Similarly my boss ModelLocator completely breaks down, since all widgets reading will share the same ModelLocator.

    Is it just me? Am I missing something? Or is the original designer of this application need to know better how he would serve a year later? What is a breakdown of the total Cairngorm design patterns?

    Yes, it looks like Cairngorm was not may not be the best choice for the 'widgets' you. I guess you have a point they should clarify better when you are not using Cairngorm. I have never tried to use when developing a component custom (or whatever it is) it's going to be added in a complete application.

    Reading various articles, I (IIRC) feel like the guys from Farata Systems (perhaps Yakov) seem not to be very keen on frameworks (Cairngorm is called a "mictoarchitecture"), but rather of focus simply on strong "design component" and using the Flex event (i.e. dispatchEvent()) system. I certainly appreciate this attitude of questioning because too often inside, it seems that people seem to accept 'best practices' and 'how it is 'supposed' to do' as bible regardless of whether she is really an added value, or add unnecessary complexity. I think that the answer to everything, always, 'it depends' and we have to use our common sense and intelligence to understand that we really gain anything by doing something 'standard' which has questionable value.

    I used the Cairngorm architecture but not meet your problem, maybe because I use it only to a "demand" level, never intend to have the product of this project integrated in what either.

    http://ColdFusion.sys-con.com/read/479472_1.htm
    (Didn't read all this, or I forgot if I did it, just put it here in case something I said about others ' opinions was not completely accurate.)

  • Colorful random Changing Patterns on iPhone 6

    Comrade Applers, of the good day

    I had a very strange experience with my iPhone... Last week, I woke up and found my iPhone looking like this... It is weird changing everywhere colorful patterns. It declined or was immersed in a liquid ever. He went just in case like that in the morning. I'm afraid it's a software problem. I tried to restore it as new and from a backup, but does not unfortunately. Someone of you have no idea what to do to fix this?

    Thank you in advance,

    MIkhail

    I'm guessing that you were not able to retrieve the device from there. Usually the appearance of strange colors and patterns on the screen is indicative of a failing LCD screen. If a factory restore does not recover the device, then it is not software. I suggest that you take a go-Genius Bar to the nearest Apple store or service provider authorized Apple to have the material examined.

  • Why is there suddenly a background pattern on my new page tabs instead of the default gray?

    A few days ago a patterned background suddenly appeared on my new tab page, making it very difficult to read. I have not add no matter what background and, as far as I know, I don't have any add-ons that would add a. I hate it and he returned to gray, but do not find a way to get rid of it. The only options I can find online offers to download an add-on and adding a new background, but I want to just the default gray.

    Try Firefox Safe mode to see if the problem goes away. Safe mode is a troubleshooting mode, which disables most of the modules.

    (If you use it, switch to the default theme).

    • Under Windows, you can open Firefox 4.0 + in Safe Mode holding the key SHIFT key when you open the desktop Firefox or shortcut in the start menu.
    • On Mac, you can open Firefox 4.0 + in Safe Mode holding the key option key when starting Firefox.
    • Under Linux, you can open Firefox 4.0 + with leaving Firefox then go to your Terminal and running Safe Mode: firefox-safe-mode (you may need to specify the installation path of Firefox for example/usr/lib/firefox)
    • Or open the Help menu and click on the restart with the disabled... modules menu item while Firefox is running.

    Once you get the pop-up, simply select "" boot mode safe. "

    If the issue is not present in Firefox Safe Mode, your problem is probably caused by an extension, and you need to understand that one. To do this, please follow article Troubleshooting extensions, themes and problems of hardware acceleration to resolve common Firefox problems .

    To exit safe mode of Firefox, simply close Firefox and wait a few seconds before you open Firefox for normal use again.

    The report please come back shortly.

  • Satellite T130 - 10G Touchpad screen pointer gets stuck in random patterns

    Satellite T130 - 10G Touchpad screen pointer gets stuck in random patterns and laptop computer must be restarted to restore functionality
    The center of the causes of "touchpad button" toggle switch by pressing the touchpad pointer to enter a random State like two fingers to zoom.

    Sometimes, he'll be back to normal, but most of the time the computer should be put to sleep or restarted to restore functionality.

    a. I tried turn off all touch pad feature one item at a time and all, he still has some weird random State.
    (Did not try the impossible combination need $ to be interested but went to the 90% level)

    b. I tried disable the touch pad buttons offending and only using the mode tap the buttons and the problem still persist.

    c. Finally, tried bending the entire keyboard instead of pressing the buttons and it has also created the problem.

    This leads me to believe either the power key or flexion of the entire keyboard is originally is

    a. flexion of the touch pad causing the driver getting into a crazy State or require a recalibration.

    b. electrical connections causing the driver enter a crazy State or require a recalibration of bending.

    Note: I have reinstall the latest version of the driver.
    Also: American Toshiba support site that this problem exists in the notebooks of May.

    Also: The touchpad is too sensitive, which makes it very unusable!

    CAry

    Have you tried to install the operating system and check the functionality of the touchpad with the factory settings?
    Recovery image contains tested the touchpad and right and I don't think that helps the driver installation.

  • Why my screen have a checkered pattern, but when I start in safe MODE it disappears?

    Why my screen have a checkered pattern, but when I start in safe MODE it disappears?

    Safe mode disables extensions in Firefox 4, and disables hardware acceleration.

    • Tools > Options > advanced > General > Browsing: "use hardware acceleration when available.

    If disable hardware acceleration works then check if there is an update available for your graphics display driver.

  • After that I changed pattern in the Mozilla Firefox browser, Mozilla does not work

    I just change the pattern in the browser. When I did this earlier nothing happen. I have change and close the open windows. When I do that the browser does not open.

    This has happened

    Each time Firefox opened

    I changed my mobile browser

    User Agent

    Opera/9.80 (Windows NT 6.0; U; PL) Presto/2.6.30 Version/10.60

    You can either see if you can start Firefox in that troubleshooting Firefox issues in Safe Mode , or remove the lines lightweightThemes of the prefs.js file in the Firefox profile folder

    Prefs in prefs.js:
    user_pref ("lightweightThemes.isThemeSelected", true);
    user_pref ("lightweightThemes.persisted.footerURL", true);
    user_pref ("lightweightThemes.persisted.headerURL", true);
    user_pref ("lightweightThemes.usedThemes", "");

Maybe you are looking for

  • How to import bookmarks? Import is not in the file menu.

    Where is the field of import. It is not men file where it should be... Turn on the Version 8 Firefox and OS X 10.7.2

  • iPlayer app will not work

    It seems a shame that there is no Google search for books on the British version of the Xoom. But having an iPlayer app that will work is beyond a joke. Is this a common problem? even when I go on the iplayer site it brings a mobile version and tells

  • Login Apple ID on the problems with Web site?

    Didn't know were this post so I thought he would get the most exposure here. Went to go and manage my Apple ID to https://appleid.apple.com/ and it seems that Apple has revamped the journal in the process. I put my Apple ID and password and then had

  • How to stop a program

    Hello I build a LabView LabView 2011 program to control experience. The entire program is contained in a stacked sequence and this sequence is maintained within a driving main while loop. This hand while the loop is controlled by a Stop button, which

  • Code signing by the keys of the company name

    If I am an individual developer (IE, not a part of the business). What should I put in the section where it asks for the name of my company?