You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/02/11 11:26:52 UTC

[GitHub] [flink] StephanEwen commented on issue #9768: [FLINK-14086][test][core] Add OperatingArchitecture Enum

StephanEwen commented on issue #9768: [FLINK-14086][test][core] Add OperatingArchitecture Enum
URL: https://github.com/apache/flink/pull/9768#issuecomment-584590929
 
 
   I think this mixes architecture and memory size is a confusing way. My original suggestion was more to change this to:
   
   ```java
   enum ProcessorArchitecture {
   
       x86(32),
       amd64(64),
       ppc64le(64),
       armv7(32),
       aarch64(64);
   
       // -----------------------------------
   
       private final int addressSize;
   
       private ProcessorArchitecture(int addressSize) {
           this.addressSize = addressSize;
       }
   
       public void addressSize() {
           return addressSize;
       }
   
       // -----------------------------------
   
       // logic to get current architecture
   
   }
   ```
   
   Then you can do things like:
   
   ```
   switch (ProcessorArchitecture.getArchitecture().addressSize()) {
       case 64:
       case 32:
   }
   
   switch (ProcessorArchitecture.getArchitecture()) {
       case x86:
           platform = "386";
           break;
       case amd64:
           platform = "amd64";
           break;
       case armv7:
           platform = "armv7";
           break;
       case aarch64:
           platform = "arm64";
           break;
       default:
           platform = "Unknown";
           break;
   }
   ```
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services