Skip to content
DataMiner DoJo

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Search in posts
Search in pages
Log in
Menu
  • Updates & Insights
  • Questions
  • Learning
    • E-learning Courses
    • Empower Replay: Limited Edition
    • Tutorials
    • Open Classroom Training
    • Certification
      • DataMiner Fundamentals
      • DataMiner Configurator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
      • Verify a certificate
    • Video Library
    • Books We Like
    • >> Go to DataMiner Docs
  • Expert Center
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Markets & Industries
      • Media production
      • Government & defense
      • Content distribution
      • Service providers
      • Partners
      • OSS/BSS
    • Agile
      • Agile Webspace
      • Everything Agile
        • The Agile Manifesto
        • Best Practices
        • Retro Recipes
      • Methodologies
        • The Scrum Framework
        • Kanban
        • Extreme Programming
      • Roles
        • The Product Owner
        • The Agile Coach
        • The Quality & UX Coach (QX)
    • DataMiner DevOps Professional Program
      • About the DevOps Program
      • DataMiner DevOps Support
  • Downloads
  • More
    • DataMiner Releases & Updates
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
    • Contact
    • Global Feedback Survey
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • >> Go to dataminer.services

What (and why) is the impact of changing my public class to public static class in DataMiner?

Solved1.71K views8th July 2020Automation QAction
3
Brecht Deconinck [SLC] [DevOps Member]1.20K 23rd June 2020 0 Comments

Scripting

What's the impact of changing my "public class QAction" to "public static class QAction"?
If there's an impact, what's the reason behind this?

Automation

What's the impact of changing my "public class Script" to "public static class Script"?
If there's an impact, what's the reason behind this?

Brecht Deconinck [SLC] [DevOps Member] Selected answer as best 8th July 2020

2 Answers

  • Active
  • Voted
  • Newest
  • Oldest
4
Laurens Moutton [SLC] [DevOps Enabler]8.74K Posted 23rd June 2020 0 Comments

To answer to the Scripting part of the question:

Marking the class as static indicates that all members of the class must be static. When executing a QAction, DataMiner will look if the method is marked as static. If it's static then no instance will be created, even if the class itself is not marked as static.

Using static classes means that this class object and its static fields are shared across all the elements running on the same DMA, in the same SLScripting process. This means that element A and element B of the same protocol driver in that case have access to the same static fields in their QAction. The application domain keeps track of static objects in the managed heap. These objects stay in there as long as the DMA is active and survives the restart of an element. When using DIS inject, the element uses a static DIS object. After the DIS inject, the element will use again the original static object.

Using classes without the static keyword means that for every element QAction class there will be an instance object created. These will then have no access to the fields of other elements of the same driver running in the same SLScripting process. The instance object will not survive an element restart and will eventually be cleaned up by the garbage collector when that walks over the managed heap. When using DIS inject, the element uses a new created instance object. After DIS inject, the element will use again a new created instance object instead of the one that was used before the DIS inject. Keep this in mind when implementing a QAction that this situation could occur.

To summarize:
-If you have no fields in the QAction class then use the static keyword, there is no need to create multiple instance objects of the QAction class. If there are 100 elements on the DMA then 100 instance objects are created when not using the static keyword. If static keyword is used then you only have one static class object in memory.
-If you have static fields in the QAction class then be aware that the static keyword means that the fields are shared across elements on the same DMA: one element could overwrite the other one, locking might be needed. The data will survive an element restart. If you're 100% sure that this will be the only element of this driver in the DMA (e.g. a manager driver) or have taken the data sharing and locking in account then you can use the static keyword. Without the static keyword this is more safe, every element will have access to only its own set of data.

Laurens Moutton [SLC] [DevOps Enabler] Changed status to publish 2nd July 2020
You are viewing 1 out of 2 answers, click here to view all answers.
Please login to be able to comment or post an answer.

My DevOps rank

DevOps Members get more insights on their profile page.

My user earnings

0 Dojo credits

Spend your credits in our swag shop.

0 Reputation points

Boost your reputation, climb the leaderboard.

Promo banner DataMiner DevOps Professiona Program
DataMiner Integration Studio (DIS)
Empower Katas
Privacy Policy • Terms & Conditions • Contact

© 2025 Skyline Communications. All rights reserved.

DOJO Q&A widget

Can't find what you need?

? Explore the Q&A DataMiner Docs

[ Placeholder content for popup link ] WordPress Download Manager - Best Download Management Plugin